modifiche a Dockerfile e inserito dockerfile.runtime
Some checks failed
Deploy to VPS / build (push) Failing after 38s
Deploy to VPS / deploy (push) Has been skipped

This commit is contained in:
AV77web 2026-07-14 16:15:32 +02:00
parent 05f1629aee
commit a2ffd71452
3 changed files with 50 additions and 6 deletions

View file

@ -18,25 +18,50 @@ jobs:
- run: npm run build
env:
VITE_API_URL: https://esameits24-26backend.andreavillari.it
- uses: https://github.com/actions/upload-artifact@v4
with:
name: frontend-dist
path: dist/
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
timeout-minutes: 15
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/download-artifact@v4
with:
name: frontend-dist
path: dist
- uses: https://github.com/appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
source: "dist"
target: "/root/esameits24-26frontend"
overwrite: true
- uses: https://github.com/appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
command_timeout: 30m
command_timeout: 10m
script: |
set -e
echo "=== START $(date -Iseconds) ==="
cd /root/esameits24-26frontend
git pull --ff-only
echo "=== DOCKER BUILD $(date -Iseconds) ==="
docker compose --progress plain up -d --build
if [ ! -d dist ] || [ -z "$(ls -A dist 2>/dev/null)" ]; then
echo "ERRORE: dist/ mancante o vuota dopo SCP"
exit 1
fi
echo "=== DOCKER BUILD RUNTIME $(date -Iseconds) ==="
docker compose -f docker-compose.prod.yml --progress plain up -d --build
echo "=== END $(date -Iseconds) ==="
docker compose ps
docker compose -f docker-compose.prod.yml ps
echo "DEPLOY COMPLETE"

11
docker-compose.prod.yml Normal file
View file

@ -0,0 +1,11 @@
# Usato dal deploy CI: build solo nginx + dist (secondi, non minuti).
services:
app:
build:
context: .
dockerfile: dockerfile/Dockerfile.runtime
image: esameits24-26frontend-app:prod
container_name: esameits24-26frontend
restart: unless-stopped
ports:
- "127.0.0.1:3010:3010"

View file

@ -0,0 +1,8 @@
# Immagine di produzione: serve la cartella dist già compilata in CI (nessun npm run build sulla VPS).
FROM nginx:alpine
COPY dockerfile/nginx.conf /etc/nginx/conf.d/default.conf
COPY dist /usr/share/nginx/html
EXPOSE 3010
CMD ["nginx", "-g", "daemon off;"]