Files
MediaManager/.github/workflows/build-push-backend.yml
maxDorninger 9b6f9ccf1d Merge remote-tracking branch 'origin/master'
# Conflicts:
#	.github/workflows/build-push-backend.yml
2025-06-01 21:13:24 +02:00

59 lines
1.6 KiB
YAML

name: Build and Push Backend Docker Image
on:
push:
branches:
- master
tags:
- 'v*.*.*'
paths:
- 'media_manager/**'
- 'alembic/**'
- 'alembic.ini'
- 'Dockerfile'
- 'pyproject.toml'
- 'uv.lock'
- '.github/workflows/build-push-backend.yml'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/backend
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=tag
type=ref,event=branch
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.meta.outputs.version }} # This will be the git tag (e.g. v1.0.0) or branch name or sha