Skip to content

Commit

Permalink
Merge pull request #57 from alltilla/debug-image-workflow
Browse files Browse the repository at this point in the history
apkbuild,github-actions: automatically create debug image
  • Loading branch information
alltilla authored Dec 15, 2023
2 parents 69ef51d + 86ec194 commit 109ba59
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/syslog-ng-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
16 changes: 15 additions & 1 deletion syslog-ng/alpine.dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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 \
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions syslog-ng/apkbuild/axoflow/syslog-ng/APKBUILD-debug.patch
Original file line number Diff line number Diff line change
@@ -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 \

0 comments on commit 109ba59

Please sign in to comment.