diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..e43e14b --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -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 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 6c8f9c7..138dc5f 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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: