Skip to content

Publish Backend Image #425

Publish Backend Image

Publish Backend Image #425

Workflow file for this run

name: Publish Backend Image
on:
workflow_dispatch:
push:
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Lowercase Image Name
run: |
REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
echo "IMAGE_NAME=${REPO_LOWER}-backend" >> $GITHUB_ENV
echo "REPO_NAME=${REPO_LOWER}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=sha,format=short
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: "."
file: "./backend/Dockerfile"
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
provenance: false