106cb5bf83
Build & Deploy / build-and-deploy (push) Failing after 39s
Uses docker compose -f /appdata/dockhand/stacks/unraid/dostalgia/compose.yaml so the container matches the user's Unraid stack configuration (correct volume mount at /mnt/cache/appdata/dostalgia, proper network, labels, etc.)
56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
# This workflow builds and deploys Dostalgia whenever code is pushed to main.
|
|
# Uses docker-compose at /appdata/dockhand/stacks/unraid/dostalgia/compose.yaml
|
|
# Requires a Gitea Actions runner registered on the host with Docker socket access.
|
|
# See: https://docs.gitea.com/usage/actions
|
|
|
|
name: Build & Deploy
|
|
run-name: Build ${{ gitea.sha.substring(0, 7) }}
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
IMAGE_NAME: dostalgia
|
|
COMPOSE_DIR: /appdata/dockhand/stacks/unraid/dostalgia
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t ${{ env.IMAGE_NAME }}:${{ gitea.sha }} .
|
|
docker tag ${{ env.IMAGE_NAME }}:${{ gitea.sha }} ${{ env.IMAGE_NAME }}:latest
|
|
|
|
- name: Deploy via docker-compose
|
|
run: |
|
|
cd "${{ env.COMPOSE_DIR }}"
|
|
docker compose up -d
|
|
|
|
- name: Verify container is running
|
|
run: |
|
|
sleep 5
|
|
CONTAINER_NAME=$(docker compose -f "${{ env.COMPOSE_DIR }}/compose.yaml" ps -q dostalgia 2>/dev/null || echo "dostalgia")
|
|
if [ -z "$CONTAINER_NAME" ] || [ "$CONTAINER_NAME" = "dostalgia" ]; then
|
|
CONTAINER_NAME="dostalgia"
|
|
fi
|
|
STATUS=$(docker inspect -f '{{.State.Status}}' "$CONTAINER_NAME" 2>/dev/null || docker inspect -f '{{.State.Status}}' dostalgia)
|
|
if [ "$STATUS" = "running" ]; then
|
|
echo "✅ Dostalgia container is running"
|
|
echo "--- last logs ---"
|
|
docker logs dostalgia --tail 5
|
|
echo "✅ Dostalgia deployed!"
|
|
else
|
|
echo "❌ Container status: $STATUS"
|
|
docker logs dostalgia --tail 30
|
|
exit 1
|
|
fi
|
|
|
|
- name: Clean up old images
|
|
run: docker image prune -f --filter "until=24h"
|