64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
tags:
|
|
- '*'
|
|
release:
|
|
types: [ published ]
|
|
|
|
env:
|
|
GITEA_CONTAINER_REG: gitea.nerthus.nl
|
|
DOCKER_IMAGE_NAME: orbits-server
|
|
|
|
jobs:
|
|
docker_build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Log in to Gitea container registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ${{ env.GITEA_CONTAINER_REG }}
|
|
username: ${{ gitea.repository_owner }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Extract Docker metadata from environment
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: |
|
|
${{ env.GITEA_CONTAINER_REG }}/daanselen/${{ env.DOCKER_IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=sha,format=short,prefix=
|
|
|
|
- name: Build and export Docker image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: ./docker/Dockerfile
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|