Skip to content

Docker build Debian image #602

Docker build Debian image

Docker build Debian image #602

# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: Docker build Debian image
on:
release:
types: [created]
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# * is a special character in YAML so you have to quote this string
# at 4 am
- cron: '0 4 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-build-debian:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
uses: docker/setup-buildx-action@v2
- name: Log in to GH packages
# https://github.com/docker/login-action
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
# https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
prefix=
suffix=-slim-bullseye
- name: Build and push Docker image
# https://github.com/docker/build-push-action
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
# platforms: linux/386, linux/amd64, linux/arm/v5, linux/arm/v7, linux/arm64/v8, linux/mips64le, linux/ppc64le, linux/s390x
platforms: linux/386, linux/amd64, linux/arm/v5, linux/arm/v7, linux/arm64/v8
push: ${{ github.event_name == 'release' && github.event.action == 'created' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}