Update docker-compose for production
Some checks failed
Deploy / deploy (push) Failing after 30s

This commit is contained in:
Benny
2026-01-29 16:52:08 -06:00
parent 888c045f1a
commit 75d011f6d6

View File

@@ -10,40 +10,42 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build API
run: |
cd api
npm ci
npx prisma generate
npm run build
- name: Build Web - name: Build Web
run: | run: |
cd web cd web
npm ci npm ci
npm run build npm run build
- name: Deploy API - name: Deploy with Docker Compose
run: | run: |
pm2 stop skymoney-api || true # Deploy directory
rm -rf /opt/skymoney/api/dist /opt/skymoney/api/node_modules APP_DIR=/opt/skymoney
cp -r api/dist /opt/skymoney/api/ mkdir -p $APP_DIR
cp -r api/node_modules /opt/skymoney/api/
cp -r api/prisma /opt/skymoney/api/
# Run migrations using the VPS .env # Sync repo to server (excluding node_modules, dist, etc)
cd /opt/skymoney/api rsync -a --delete \
set -a --exclude=node_modules \
source .env --exclude=dist \
set +a --exclude=.git \
npx prisma migrate deploy --exclude=.gitea \
--exclude=backups \
--exclude=exporting \
./ $APP_DIR/
pm2 start /opt/skymoney/api/dist/server.js --name skymoney-api # Copy built web to shared volume
mkdir -p /var/www/skymoney/dist
- name: Deploy Web
run: |
rm -rf /var/www/skymoney/dist/*
cp -r web/dist/* /var/www/skymoney/dist/ cp -r web/dist/* /var/www/skymoney/dist/
cd $APP_DIR
# Build and start all services
docker compose up -d --build
# Wait for database to be ready
sleep 10
# Run Prisma migrations inside the API container
docker compose exec -T api npx prisma migrate deploy
- name: Reload Nginx - name: Reload Nginx
run: sudo systemctl reload nginx run: sudo systemctl reload nginx