add workflow
Build and Publish Containers / build-and-push (., backend/Dockerfile, rmtpocketwatcher-backend, backend) (push) Failing after 1m36s
Build and Publish Containers / build-and-push (., backend/Dockerfile, rmtpocketwatcher-backend, backend) (push) Failing after 1m36s
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
name: Build and Publish Containers
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
paths:
|
||||||
|
- "backend/**"
|
||||||
|
- ".gitea/workflows/docker-publish.yml"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.GITEA_REGISTRY || 'git.hudsonriggs.systems' }}
|
||||||
|
REGISTRY_USERNAME: ${{ github.actor }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
IMAGE_NAMESPACE: ${{ vars.GITEA_IMAGE_NAMESPACE || github.repository_owner }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: backend
|
||||||
|
context: .
|
||||||
|
dockerfile: backend/Dockerfile
|
||||||
|
image: rmtpocketwatcher-backend
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Validate registry settings
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ -z "${REGISTRY_PASSWORD}" ]; then
|
||||||
|
echo "Missing registry credentials. Set REGISTRY_TOKEN or ensure GITHUB_TOKEN has package write access." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}
|
||||||
|
tags: |
|
||||||
|
type=sha
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ${{ matrix.context }}
|
||||||
|
file: ${{ matrix.dockerfile }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}:buildcache,mode=max
|
||||||
@@ -4,8 +4,8 @@ POSTGRES_PASSWORD=your_secure_password_here
|
|||||||
POSTGRES_DB=rmtpocketwatcher
|
POSTGRES_DB=rmtpocketwatcher
|
||||||
|
|
||||||
# Docker Registry Configuration
|
# Docker Registry Configuration
|
||||||
DOCKER_REGISTRY=ghcr.io
|
DOCKER_REGISTRY=your-gitea.example.com
|
||||||
DOCKER_IMAGE=lambdabanking/rmtpocketwatcher-backend
|
DOCKER_IMAGE=your-org-or-user/rmtpocketwatcher-backend
|
||||||
IMAGE_TAG=latest
|
IMAGE_TAG=latest
|
||||||
|
|
||||||
# Backend Configuration
|
# Backend Configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user