ci: add Gitea Actions workflow to build and push Docker image
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
On push to main (or version tag), the workflow logs into the Gitea container registry, builds a multi-tag image (sha-<short>, branch name, 'latest' on main, version on tag) and pushes to gitea.siegeln.net/<owner>/<repo>. docker-compose.prod.yml now pulls from the registry by default, with KOCHWAS_TAG env var to pin a specific build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
54
.gitea/workflows/docker.yml
Normal file
54
.gitea/workflows/docker.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Build & Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.siegeln.net
|
||||
IMAGE_NAME: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
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 Gitea container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Derive tags
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=sha,format=short
|
||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -1,7 +1,9 @@
|
||||
services:
|
||||
kochwas:
|
||||
build: .
|
||||
image: kochwas:latest
|
||||
# Image wird via Gitea Actions gebaut und in die Gitea-Container-Registry gepusht.
|
||||
# Tag-Override per Umgebungsvariable: KOCHWAS_TAG=sha-abcd1234 docker compose pull
|
||||
image: gitea.siegeln.net/claude/kochwas:${KOCHWAS_TAG:-latest}
|
||||
pull_policy: always
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
|
||||
Reference in New Issue
Block a user