Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]