Skip to content

chore(deps): update actions/checkout digest to f43a0e5 #89

chore(deps): update actions/checkout digest to f43a0e5

chore(deps): update actions/checkout digest to f43a0e5 #89

name: "Docker: Build & Push"
on:
push:
branches:
- main
paths:
- '.github/workflows/docker-build-push.yml'
- 'Dockerfile'
- 'volta.version'
pull_request:
branches:
- main
paths:
- '.github/workflows/docker-build-push.yml'
- 'Dockerfile'
- 'volta.version'
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-push-debian:
name: Build & Push
runs-on: ubuntu-latest
strategy:
matrix:
debianVersion: [bullseye, bullseye-slim, buster, buster-slim, stretch-slim, stretch, bookworm, bookworm-slim]
steps:
# Enable tmate debugging of manually-triggered workflows
# if the input option was provided.
- name: Setup SSH debug session
uses: mxschmitt/action-tmate@8b4e4ac71822ed7e0ad5fb3d1c33483e9e8fb270 # tag=v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- name: Check out repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Get Volta version
id: volta
run: |
echo ::set-output name=version::$(< volta.version)
- name: Is this the latest image?
id: latest
run: |
echo ::set-output name=islatest::${{ endsWith(matrix.debianVersion, 'bullseye') }}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # tag=v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # tag=v2
- name: Cache Docker layers
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129 # tag=v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-buildx-
- name: Set Docker image metadata
id: docker_meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # tag=v4
with:
images: domjtalbot/volta,ghcr.io/domjtalbot/volta
flavor: |
latest=${{ steps.latest.outputs.islatest }}
tags: |
${{ matrix.debianVersion }}
current-${{ matrix.debianVersion }}
${{ steps.volta.outputs.version }}-${{ matrix.debianVersion }}
labels: |
org.opencontainers.image.version=
current-${{ steps.volta.outputs.version }}-${{ matrix.debianVersion }}
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # tag=v2
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # tag=v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # tag=v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
build-args: |
DEBIAN_VERSION=${{ matrix.debianVersion }}
VERSION=${{ steps.volta.outputs.version }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- # Temporary fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache