Align workflow with debshots pattern: docker CLI, permissions, layer caching
All checks were successful
Build and push container image / build-and-push (push) Successful in 6m0s

This commit is contained in:
Christoph Haas 2026-08-22 11:51:02 +02:00
parent 5e45dd358a
commit fc04ea7900

View file

@ -1,3 +1,10 @@
# =============================================================================
# Forgejo Actions workflow to build and push Docker image
# =============================================================================
# Triggered on push to main. Pushes :latest plus :$SHA tags; the SHA matches
# what the service reports at GET /version.
# -----------------------------------------------------------------------------
name: Build and push container image
on:
@ -10,21 +17,30 @@ env:
jobs:
build-and-push:
runs-on: docker
permissions:
contents: read
packages: write
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Buildx
- name: Install Docker CLI
run: |
apt-get update -qq
apt-get install -y --no-install-recommends docker.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Forgejo registry
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.workaround.org
username: chaas
username: ${{ github.actor }}
password: ${{ secrets.FORGEJO_TOKEN }}
- name: Build and push
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
@ -34,3 +50,5 @@ jobs:
tags: |
${{ env.IMAGE }}:latest
${{ env.IMAGE }}:${{ github.sha }}
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max