Skip to content

Updated base container to debian 12 (bookworm) #35

Updated base container to debian 12 (bookworm)

Updated base container to debian 12 (bookworm) #35

Workflow file for this run

# Most of this workflow is based on this blog post: https://bee42.com/de/blog/tutorials/dockerized-the-apple-silicon/
name: Build image
on:
workflow_dispatch:
push:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
tags:
- "v*.*.*"
# schedule:
# - cron: "0 22 * * *"
jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest
env:
IMAGE_NAMESPACE: dbck
IMAGE_NAME: mailtrap
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Expose additional environment variables
uses: FranzDiebold/github-env-vars-action@v2
- name: Prepare tags
id: prep
run: |
DOCKER_IMAGE=${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
VERSION=snapshot
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${{ env.CI_SHA_SHORT }}"
fi
echo ::set-output name=tags::${TAGS}
echo ::set-output name=version::${VERSION}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
context: build/
file: build/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.prep.outputs.version }}
release_name: ${{ steps.prep.outputs.version }}
draft: false
prerelease: false