debshots/.forgejo/workflows/build_container.yaml
Christoph Haas 9340529d3f
Some checks failed
Build and Push Docker Image / build-and-push-image (push) Failing after 3m13s
Merge branch 'main' of ssh://forgejo/chaas/debshots
2026-04-12 23:30:57 +02:00

63 lines
2.3 KiB
YAML

# =============================================================================
# Forgejo Actions workflow to build and push Docker image
# =============================================================================
# Triggered on push to main or master branches
# -----------------------------------------------------------------------------
name: Build and Push Docker Image
on:
push:
branches:
- main
- master
jobs:
build-and-push-image:
runs-on: docker
permissions:
contents: read
packages: write
steps:
# -------------------------------------------------------------------------
# Check out repository code
# -------------------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4
# -------------------------------------------------------------------------
# Install Docker CLI (not cached in image, needed for buildx)
# -------------------------------------------------------------------------
- name: Install Docker
run: |
apt-get update -qq
apt-get install -y --no-install-recommends docker.io
# -------------------------------------------------------------------------
# Set up Docker Buildx for layer caching
# -------------------------------------------------------------------------
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# -------------------------------------------------------------------------
# Authenticate with Forgejo container registry
# -------------------------------------------------------------------------
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.pmd5.org
username: ${{ github.actor }}
password: ${{ secrets.FORGEJO_TOKEN }}
# -------------------------------------------------------------------------
# Build and push image with GitHub Actions cache
# -------------------------------------------------------------------------
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: git.pmd5.org/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max