parent
4e0426fb51
commit
55dc434919
5 changed files with 55 additions and 23 deletions
34
.forgejo/workflows/ci.yml
Normal file
34
.forgejo/workflows/ci.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildx:
|
||||||
|
runs-on: docker
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ vars.CONTAINER_REGISTRY }}/${{ github.repository }}:latest
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
build/
|
||||||
|
*.d
|
||||||
|
debian/changelog
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
WORKDIR /work
|
||||||
|
ADD . /work
|
||||||
|
RUN apt-get update && apt-get -y install build-essential debhelper
|
||||||
|
RUN make debian-package
|
||||||
|
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
COPY --from=0 tellusagent_*.deb /
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get install -y ./tellusagent_*.deb && rm ./tellusagent_*.deb
|
||||||
|
ENTRYPOINT ["/opt/TellusAgent/tellusagent"]
|
28
Makefile
28
Makefile
|
@ -2,11 +2,6 @@ BUILD := $(shell date -u +%Y%m%d-%H%M%S)
|
||||||
OS := $(shell uname -s)
|
OS := $(shell uname -s)
|
||||||
|
|
||||||
PREFIX = $(DESTDIR)/opt/TellusAgent
|
PREFIX = $(DESTDIR)/opt/TellusAgent
|
||||||
TOOLKIT = ../..
|
|
||||||
|
|
||||||
DIRECTORIES = \
|
|
||||||
$(TOOLKIT)/Common \
|
|
||||||
$(TOOLKIT)/Rewind
|
|
||||||
|
|
||||||
ifeq ($(CI_PIPELINE_CREATED_AT), )
|
ifeq ($(CI_PIPELINE_CREATED_AT), )
|
||||||
VERSION := $(shell date -u +%Y%m%d-%H%M%S)
|
VERSION := $(shell date -u +%Y%m%d-%H%M%S)
|
||||||
|
@ -15,15 +10,10 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), Linux)
|
ifeq ($(OS), Linux)
|
||||||
BUILD := $(VERSION)-$(shell lsb_release -i -s | tr '[:upper:]' '[:lower:]')$(shell lsb_release -r -s)
|
|
||||||
ARCHITECTURE ?= $(shell $(CC) -dumpmachine | grep -o -E '^[^-]+')
|
ARCHITECTURE ?= $(shell $(CC) -dumpmachine | grep -o -E '^[^-]+')
|
||||||
ifeq ($(ARCHITECTURE), aarch64)
|
ifeq ($(ARCHITECTURE), aarch64)
|
||||||
FLAGS += -march=armv8-a
|
FLAGS += -march=armv8-a
|
||||||
endif
|
endif
|
||||||
ifeq ($(ARCHITECTURE), x86_64)
|
|
||||||
FLAGS += -fPIC
|
|
||||||
endif
|
|
||||||
FLAGS += -rdynamic
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
|
@ -35,11 +25,11 @@ OBJECTS = \
|
||||||
|
|
||||||
FLAGS += -g -fno-omit-frame-pointer -O3 -MMD \
|
FLAGS += -g -fno-omit-frame-pointer -O3 -MMD \
|
||||||
-DVERSION=\"$(VERSION)\" \
|
-DVERSION=\"$(VERSION)\" \
|
||||||
$(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(BUILD)\"
|
$(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(VERSION)\"
|
||||||
|
|
||||||
LIBS += $(foreach library, $(LIBRARIES), -l$(library))
|
LIBS += $(foreach library, $(LIBRARIES), -l$(library))
|
||||||
|
|
||||||
CC = gcc
|
CC ?= gcc
|
||||||
CFLAGS += $(FLAGS) -std=gnu99
|
CFLAGS += $(FLAGS) -std=gnu99
|
||||||
|
|
||||||
ifneq ($(strip $(DEPENDENCIES)),)
|
ifneq ($(strip $(DEPENDENCIES)),)
|
||||||
|
@ -70,19 +60,13 @@ endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PREREQUISITES) $(OBJECTS) tellusagent
|
rm -f $(PREREQUISITES) $(OBJECTS) tellusagent
|
||||||
rm -f *.d $(TOOLKIT)/*/*.d
|
|
||||||
|
|
||||||
debian-package:
|
debian-package:
|
||||||
./UpdateLog.sh tellusagent "Artem Prilutskiy <cyanide.burnout@gmail.com>" $(BUILD) > debian/changelog
|
./UpdateLog.sh tellusagent "Artem Prilutskiy <cyanide.burnout@gmail.com>" $(VERSION) > debian/changelog
|
||||||
ifdef ARCH
|
dpkg-buildpackage --post-clean --no-sign -i -I -b
|
||||||
dpkg-buildpackage -b -a$(ARCH) -tc
|
|
||||||
else
|
|
||||||
dpkg-buildpackage -b -tc
|
|
||||||
endif
|
|
||||||
|
|
||||||
docker-image: debian-package
|
docker-image:
|
||||||
DISTRIBUTION=$(shell echo ${ARCHITECTURE} | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)
|
docker buildx build -t tellusagent:$(VERSION) -o type=tar,dest=tellusagent-docker.tar .
|
||||||
docker buildx build -t tellusagent:$(VERSION) --platform linux/$(DISTRIBUTION) -o type=tar,dest=- . | gzip > build/tellusagent_$(VERSION)-$(DISTRIBUTION).tar.gz
|
|
||||||
|
|
||||||
macos-archive: build
|
macos-archive: build
|
||||||
zip ../TellusAgent-macOS.zip tellusagent tellusagent.sh tellusagent.conf tellusagent.plist
|
zip ../TellusAgent-macOS.zip tellusagent tellusagent.sh tellusagent.conf tellusagent.plist
|
||||||
|
|
2
debian/compat
vendored
2
debian/compat
vendored
|
@ -1 +1 @@
|
||||||
7
|
9
|
||||||
|
|
Loading…
Add table
Reference in a new issue