Updated release workflow. Added docker compose for the API.
Some checks failed
Some checks failed
This commit is contained in:
@@ -95,3 +95,35 @@ jobs:
|
|||||||
"prerelease": ${GITHUB_REF_NAME##*-rc*:+false}${GITHUB_REF_NAME##*-rc*:-true}
|
"prerelease": ${GITHUB_REF_NAME##*-rc*:+false}${GITHUB_REF_NAME##*-rc*:-true}
|
||||||
}
|
}
|
||||||
JSON
|
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
|
||||||
|
|||||||
18
deploy/docker-compose.api.yml
Normal file
18
deploy/docker-compose.api.yml
Normal 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
|
||||||
Reference in New Issue
Block a user