From ad106cf2ddb24123726f5048c3861b888529f42a Mon Sep 17 00:00:00 2001 From: "Nelo-T. Wallus" Date: Sat, 8 Feb 2025 16:07:35 +0100 Subject: [PATCH 1/2] Add Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..36d9941 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine AS builder + +RUN apk --no-cache add make gcc lua lua-dev openssl openssl-dev libc-dev pcre pcre-dev pcre2-dev + +WORKDIR /build + +ADD . /build +RUN make && make install + +FROM alpine + +COPY --from=builder /usr/local/bin/imapfilter /usr/local/bin/imapfilter +COPY --from=builder /usr/local/share/imapfilter /usr/local/share/imapfilter + +RUN apk --no-cache add lua lua-dev openssl pcre git \ + && adduser -D -u 1000 imapfilter + +USER imapfilter + +ENTRYPOINT ["/usr/local/bin/imapfilter"] From a4f7a32d90a05edd414b65a73c3d8f7110e00227 Mon Sep 17 00:00:00 2001 From: "Nelo-T. Wallus" Date: Sat, 8 Feb 2025 16:07:46 +0100 Subject: [PATCH 2/2] Add workflow building and pushing docker images --- .github/workflows/docker.yml | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..67e7edb --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,53 @@ +--- +name: docker + +on: + push: + branches: + - '*' + tags: + - v* + pull_request: + branches: + - '*' + workflow_dispatch: {} + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + with: + # Spurious segfaults when compiling + # https://github.com/docker/setup-qemu-action/issues/188 + image: tonistiigi/binfmt:qemu-v8.1.5 + - uses: docker/setup-buildx-action@v3 + + - uses: docker/metadata-action@v5 + id: meta + with: + flavor: | + latest=false + images: | + name=ghcr.io/${{ github.repository }},enable=${{ github.repository == 'lefcha/imapfilter' }} # publishing to ghcr.io/lefcha/imapfilter + name=ghcr.io/${{ github.actor }}/imapfilter,enable=true # publish to the (PR) author's packages + tags: | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} # set latest tag for releases + type=semver,pattern={{raw}} # uses git tag as image tag + type=ref,event=branch + type=ref,event=pr + type=sha + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/arm/v7