name: Build and Deploy on: push: branches: - main jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build Docker image run: | docker build -t oma-memorial:latest . - name: Stop and remove old container run: | docker stop oma-memorial || true docker rm oma-memorial || true - name: Run container in proxy network run: | docker run -d \ --name oma-memorial \ --network proxy \ --restart unless-stopped \ -e NODE_ENV=production \ -v $(pwd)/data:/app/data \ oma-memorial:latest - name: Health check run: | sleep 10 docker exec oma-memorial curl -f http://localhost:3000 || exit 1 - name: Show container logs if: always() run: docker logs oma-memorial --tail 50