Updated release workflow. Added docker compose for the API.
Some checks failed
ci / build-test (push) Successful in 2m6s
ci / publish-image (push) Has been skipped
release / Build & Publish Image (push) Failing after 11s
release / Create Gitea Release (push) Has been skipped
release / Deploy API (Production) (push) Has been skipped

This commit is contained in:
2025-12-07 20:13:25 -05:00
parent cf37c2ad12
commit 671198cf98
2 changed files with 50 additions and 0 deletions

View File

@@ -95,3 +95,35 @@ jobs:
"prerelease": ${GITHUB_REF_NAME##*-rc*:+false}${GITHUB_REF_NAME##*-rc*:-true}
}
JSON
deploy-api:
name: Deploy API (Production)
needs: build-and-publish-image
runs-on: [self-hosted, linux, x64, docker] # your Synology runner
environment: production # optional: add env protection rules in Gitea
steps:
- uses: actions/checkout@v4
- name: Docker login (pull private image)
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" \
| docker login "${{ secrets.REGISTRY_HOST }}" \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin
- name: Render env file for compose
run: |
mkdir -p deploy
cat > deploy/.env <<EOF
REGISTRY=${{ secrets.REGISTRY_HOST }}
IMAGE_NS=${{ github.repository }}
TAG=${GITHUB_REF_NAME}
DB_CONN=${{ secrets.DB_CONNECTION_STRING }}
ALLOWED_ORIGINS=${{ secrets.ALLOWED_ORIGINS }}
TZ=America/Detroit
EOF
- name: Deploy (pull & up -d)
run: |
docker compose -f deploy/docker-compose.api.yml --env-file deploy/.env pull
docker compose -f deploy/docker-compose.api.yml --env-file deploy/.env up -d

View File

@@ -0,0 +1,18 @@
services:
api:
image: ${REGISTRY}/${IMAGE_NS}:${TAG}
container_name: jsmr-api
restart: unless-stopped
environment:
ASPNETCORE_URLS: http://+:8080
ASPNETCORE_ENVIRONMENT: Production
ConnectionStrings__Default: ${DB_CONN}
CORS__AllowedOrigins: ${ALLOWED_ORIGINS}
TZ: ${TZ:-America/Detroit}
ports:
- "8080:8080" # or remove and put behind your Synology reverse-proxy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8080/health"]
interval: 10s
timeout: 3s
retries: 12