sdp-request-watcher/.gitea/workflows/docker.yml
Skylar Grant c2cf725819 Add Docker image, example compose file and Gitea build workflow
- Dockerfile: node:24-alpine, production deps only, runs as the node
  user, healthcheck on /healthz. No volume, because the server keeps
  no state.
- docker-compose.yml: example for the VPS. It publishes no ports,
  since Docker's port publishing bypasses ufw and would skip NPM's IP
  access list. It joins NPM's network instead.
- .gitea/workflows/docker.yml: on v*-prod* tags, builds on the
  self-hosted runner and pushes v0idf1sh/sdp-dashboard:<tag> and
  :latest using the DHUB_UNAME and DHUB_PASS secrets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 19:38:08 -04:00

44 lines
1.1 KiB
YAML

# Builds the image and pushes it to Docker Hub when a production tag (e.g. v1.1.0-prod1) is pushed.
# Restarting the container on the VPS is done by hand for now.
name: Build and push image
on:
push:
tags:
- 'v*-prod*'
env:
IMAGE: v0idf1sh/sdp-dashboard
jobs:
build:
runs-on: self-hosted
steps:
- name: Check out
uses: actions/checkout@v4
- name: Log in to Docker Hub
env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
DHUB_PASS: ${{ secrets.DHUB_PASS }}
run: echo "$DHUB_PASS" | docker login --username "$DHUB_UNAME" --password-stdin
- name: Build
run: |
docker build \
--pull \
--label "org.opencontainers.image.version=${{ gitea.ref_name }}" \
--label "org.opencontainers.image.revision=${{ gitea.sha }}" \
-t "$IMAGE:${{ gitea.ref_name }}" \
-t "$IMAGE:latest" \
.
- name: Push
run: |
docker push "$IMAGE:${{ gitea.ref_name }}"
docker push "$IMAGE:latest"
- name: Log out
if: always()
run: docker logout