diff --git a/.github/workflows/syslog-ng-docker.yml b/.github/workflows/syslog-ng-docker.yml index 15faf96a21..a7554e209e 100644 --- a/.github/workflows/syslog-ng-docker.yml +++ b/.github/workflows/syslog-ng-docker.yml @@ -16,6 +16,7 @@ on: env: DOCKER_IMAGE_NAME: ghcr.io/axoflow/axosyslog PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 + DEBUG_PLATFORM: linux/amd64 jobs: docker: @@ -58,15 +59,18 @@ jobs: run: | if [[ '${{ inputs.pkg-type }}' = 'stable' ]]; then TAGS='${{ steps.docker-metadata-tags.outputs.tags }}' + DEBUG_TAGS='${{ steps.docker-metadata-tags.outputs.tags }}-dbg' elif [[ '${{ inputs.pkg-type }}' = 'nightly' ]]; then TAGS="${DOCKER_IMAGE_NAME}:nightly,${DOCKER_IMAGE_NAME}:${{ inputs.snapshot-version }}" + DEBUG_TAGS="${DOCKER_IMAGE_NAME}:nightly-dbg,${DOCKER_IMAGE_NAME}:${{ inputs.snapshot-version }}-dbg" else echo Unexpected input: pkg-type=${{ inputs.pkg-type }} false fi echo "TAGS=$TAGS" >> $GITHUB_OUTPUT + echo "DEBUG_TAGS=$DEBUG_TAGS" >> $GITHUB_OUTPUT - - name: Build and push Docker image + - name: Build and push production Docker image uses: docker/build-push-action@v3 with: context: syslog-ng @@ -80,3 +84,16 @@ jobs: build-args: | PKG_TYPE=${{ inputs.pkg-type }} SNAPSHOT_VERSION=${{ inputs.snapshot-version }} + + - name: Build and push debug Docker image + uses: docker/build-push-action@v3 + with: + context: syslog-ng + file: syslog-ng/alpine.dockerfile + platforms: ${{ env.DEBUG_PLATFORM }} + push: true + tags: ${{ steps.tags.outputs.DEBUG_TAGS }} + build-args: | + PKG_TYPE=${{ inputs.pkg-type }} + SNAPSHOT_VERSION=${{ inputs.snapshot-version }} + DEBUG=true diff --git a/syslog-ng/alpine.dockerfile b/syslog-ng/alpine.dockerfile index e138a9e115..3508da9524 100644 --- a/syslog-ng/alpine.dockerfile +++ b/syslog-ng/alpine.dockerfile @@ -1,7 +1,10 @@ +ARG DEBUG=false + FROM alpine:3.18 as apkbuilder ARG PKG_TYPE=stable ARG SNAPSHOT_VERSION +ARG DEBUG RUN apk add --update-cache \ alpine-conf \ @@ -14,6 +17,9 @@ RUN apk add --update-cache \ USER builder WORKDIR /home/builder ADD --chown=builder:builder apkbuild . + +RUN [ $DEBUG = false ] || patch -d axoflow/syslog-ng -p1 -i APKBUILD-debug.patch + RUN mkdir packages \ && abuild-keygen -n -a \ && printf 'export JOBS=$(nproc)\nexport MAKEFLAGS=-j$JOBS\n' >> .abuild/abuild.conf \ @@ -31,6 +37,8 @@ RUN mkdir packages \ FROM alpine:3.18 +ARG DEBUG + # https://github.com/opencontainers/image-spec/blob/main/annotations.md LABEL maintainer="axoflow.io" LABEL org.opencontainers.image.title="AxoSyslog" @@ -75,7 +83,13 @@ RUN apk add --repository /axoflow -U --upgrade --no-cache \ syslog-ng-tags-parser \ syslog-ng-xml -RUN /var/lib/syslog-ng-venv/bin/pip install -U urllib3==1.26.18 +RUN [ $DEBUG = false ] || apk add -U --upgrade --no-cache \ + gdb \ + valgrind \ + strace \ + perf \ + vim \ + musl-dbg EXPOSE 514/udp EXPOSE 601/tcp diff --git a/syslog-ng/apkbuild/axoflow/syslog-ng/APKBUILD-debug.patch b/syslog-ng/apkbuild/axoflow/syslog-ng/APKBUILD-debug.patch new file mode 100644 index 0000000000..d794fa47b2 --- /dev/null +++ b/syslog-ng/apkbuild/axoflow/syslog-ng/APKBUILD-debug.patch @@ -0,0 +1,19 @@ +--- a/APKBUILD 2023-12-13 13:55:56.402001521 +0100 ++++ b/APKBUILD 2023-12-13 13:55:23.725512362 +0100 +@@ -11,7 +11,7 @@ pkgdesc="Next generation logging daemon" + url="https://www.syslog-ng.com/products/open-source-log-management/" + arch="all" + license="GPL-2.0-or-later" +-options="!check" # unit tests require https://github.com/Snaipe/Criterion with deps ++options="!check !strip" # unit tests require https://github.com/Snaipe/Criterion with deps + makedepends=" + bison + bpftool +@@ -84,6 +84,7 @@ done + build() { + CFLAGS="$CFLAGS -flto=auto" \ + ./configure \ ++ --enable-debug \ + --prefix=/usr \ + --sysconfdir=/etc/syslog-ng \ + --localstatedir=/var/lib/syslog-ng \