Files
rocky-dev-container/.gitea/workflows/docker-image-linux.yml
Stephen Simpson dbbf9df02d
All checks were successful
Build and publish Docker image / build-and-push (push) Successful in 5m32s
Run Actions / build-and-push-image (push) Successful in 10s
fix: update workflow name and improve Docker metadata extraction steps
Signed-off-by: Stephen Simpson <ssimpson89@users.noreply.github.com>
2025-04-29 16:26:48 -07:00

63 lines
1.7 KiB
YAML

name: Build and publish Docker image
on:
push:
branches:
- dev
- master
tags:
- '*.*.*'
workflow_dispatch:
env:
REGISTRY: gitea.sjs.io
IMAGE_NAME: rocky-dev
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.USERNAME }}
password: ${{ secrets.PASS }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ vars.USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
# Only tag with version and latest on tag push
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
# Optionally, tag dev/master builds with branch name (for testing)
type=ref,event=branch,enable=${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max