Files
OverSnitch/.gitea/workflows/build.yml
T
josh 3eeac0fe10 Add Docker build and Gitea Actions CI for deployment
Multi-stage Alpine Dockerfile producing a standalone Next.js image
with the better-sqlite3 native addon included. Gitea workflow builds
on push to main and on v* tags, pushing to the Gitea registry using
the REGISTRY_URL variable and REGISTRY_TOKEN secret. Compose file
mounts ./data so alerts.db and settings.json persist across restarts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 10:04:22 -04:00

49 lines
1.5 KiB
YAML

name: Build and Push
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Derive image reference
id: img
run: |
echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Compute tags
id: tags
run: |
IMAGE="${{ vars.REGISTRY_URL }}/${{ steps.img.outputs.name }}"
TAGS="${IMAGE}:${{ steps.img.outputs.sha_short }}"
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
TAGS="${TAGS},${IMAGE}:latest"
fi
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
TAGS="${TAGS},${IMAGE}:${GITHUB_REF_NAME}"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=registry,ref=${{ vars.REGISTRY_URL }}/${{ steps.img.outputs.name }}:buildcache
cache-to: type=registry,ref=${{ vars.REGISTRY_URL }}/${{ steps.img.outputs.name }}:buildcache,mode=max