diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..0b59292 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a7cffe --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +*.d +debian/changelog diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..af25f74 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/Makefile b/Makefile index cf89395..32f2401 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,6 @@ BUILD := $(shell date -u +%Y%m%d-%H%M%S) OS := $(shell uname -s) PREFIX = $(DESTDIR)/opt/TellusAgent -TOOLKIT = ../.. - -DIRECTORIES = \ - $(TOOLKIT)/Common \ - $(TOOLKIT)/Rewind ifeq ($(CI_PIPELINE_CREATED_AT), ) VERSION := $(shell date -u +%Y%m%d-%H%M%S) @@ -15,15 +10,10 @@ else endif 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 '^[^-]+') ifeq ($(ARCHITECTURE), aarch64) FLAGS += -march=armv8-a endif -ifeq ($(ARCHITECTURE), x86_64) - FLAGS += -fPIC -endif - FLAGS += -rdynamic endif ifeq ($(OS), Darwin) @@ -35,11 +25,11 @@ OBJECTS = \ FLAGS += -g -fno-omit-frame-pointer -O3 -MMD \ -DVERSION=\"$(VERSION)\" \ - $(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(BUILD)\" + $(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(VERSION)\" LIBS += $(foreach library, $(LIBRARIES), -l$(library)) -CC = gcc +CC ?= gcc CFLAGS += $(FLAGS) -std=gnu99 ifneq ($(strip $(DEPENDENCIES)),) @@ -70,19 +60,13 @@ endif clean: rm -f $(PREREQUISITES) $(OBJECTS) tellusagent - rm -f *.d $(TOOLKIT)/*/*.d debian-package: - ./UpdateLog.sh tellusagent "Artem Prilutskiy " $(BUILD) > debian/changelog -ifdef ARCH - dpkg-buildpackage -b -a$(ARCH) -tc -else - dpkg-buildpackage -b -tc -endif + ./UpdateLog.sh tellusagent "Artem Prilutskiy " $(VERSION) > debian/changelog + dpkg-buildpackage --post-clean --no-sign -i -I -b -docker-image: debian-package - DISTRIBUTION=$(shell echo ${ARCHITECTURE} | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) - docker buildx build -t tellusagent:$(VERSION) --platform linux/$(DISTRIBUTION) -o type=tar,dest=- . | gzip > build/tellusagent_$(VERSION)-$(DISTRIBUTION).tar.gz +docker-image: + docker buildx build -t tellusagent:$(VERSION) -o type=tar,dest=tellusagent-docker.tar . macos-archive: build zip ../TellusAgent-macOS.zip tellusagent tellusagent.sh tellusagent.conf tellusagent.plist diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9