Build and push Docker images #144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker images | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '32 1 * * 6' # every Saturday at 01:32 | |
jobs: | |
docker: | |
name: Build and publish | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- v14.0.0 | |
- v13.3.1 | |
- v13.3.0 | |
- v13.2.0 | |
- v13.1.0 | |
- v13.0.1 | |
- v13.0.0 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
repository: docker-mailserver/docker-mailserver | |
submodules: recursive | |
ref: ${{ matrix.version }} | |
- name: Check out fixes required for docker build | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
clamav-base-image.patch | |
sparse-checkout-cone-mode: false | |
path: patch_files | |
- name: Apply fixes required for docker build | |
shell: bash | |
run: | | |
patch -p1 -f --no-backup-if-mismatch < patch_files/clamav-base-image.patch | |
rm -f clamav-base-image.patch | |
- name: Determine required variable values | |
id: vars | |
shell: bash | |
run: | | |
echo "version=$(<VERSION)" >> $GITHUB_OUTPUT | |
echo "git_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
build-args: | | |
DMS_RELEASE=${{ matrix.version }} | |
VCS_REVISION=${{ steps.vars.outputs.git_sha }} | |
VCS_VERSION=${{ steps.vars.outputs.version }} | |
platforms: linux/amd64,linux/arm64 | |
tags: aspettl/docker-mailserver:${{ matrix.version }} | |
provenance: false | |
push: true |