name: CD on: push: branches: [main] workflow_dispatch: jobs: deploy: runs-on: [self-hosted, linux, docker, ubuntu-latest] environment: production steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: registry: git.allucanget.biz username: ${{ secrets.GITEA_USERNAME }} password: ${{ secrets.GITEA_TOKEN }} - name: Pull latest images run: | docker pull git.allucanget.biz/zwitschi/linearvoid/playout:latest || true docker pull git.allucanget.biz/zwitschi/linearvoid/chat:latest || true docker pull git.allucanget.biz/zwitschi/linearvoid/frontend:latest || true docker pull git.allucanget.biz/zwitschi/linearvoid/nginx:latest || true - name: Deploy with docker-compose run: | docker compose -f docker-compose.prod.yml pull docker compose -f docker-compose.prod.yml up -d --remove-orphans - name: Health check run: | sleep 10 curl -f http://localhost:8080/health || exit 1 curl -f http://localhost:3000/health || exit 1 curl -f http://localhost:8081/health || exit 1 - name: Cleanup old images run: | docker image prune -f --filter "until=24h"