Shumiland/docker-compose.prod.yml
Vadym Samoilenko d1268c47a8
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions
feat(deploy): SQL delta migration + NEXT_PUBLIC_SITE_URL build arg
- migrations/0002_delta.sql: idempotent SQL extracted from 20260515_162527.ts
  (redirects table, locations detail fields, globals versioning, new pages)
  so the psql migrator container applies it on next deploy
- Dockerfile: ARG/ENV NEXT_PUBLIC_SITE_URL in builder stage so the URL is
  baked into the Next.js bundle (fixes postMessage origin warning in admin)
- docker-compose.prod.yml: pass build arg NEXT_PUBLIC_SITE_URL=https://shumi.ai-impress.com

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:56:56 +01:00

91 lines
2.4 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: shumiland-postgres
environment:
POSTGRES_USER: shumiland
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: shumiland
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U shumiland']
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- internal
migrate:
build:
context: .
dockerfile: Dockerfile.migrator
container_name: shumiland-migrate
env_file: .env.production
depends_on:
postgres:
condition: service_healthy
volumes:
- ./migrations:/app/migrations
networks:
- internal
restart: "no"
app:
build:
context: .
args:
NEXT_PUBLIC_SITE_URL: https://shumi.ai-impress.com
container_name: shumiland-app
env_file: .env.production
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
volumes:
- media_uploads:/app/media
restart: unless-stopped
networks:
- internal
- traefik-public
labels:
- traefik.enable=true
- traefik.http.routers.shumiland.rule=Host(`shumi.ai-impress.com`)
- traefik.http.routers.shumiland.entrypoints=websecure
- traefik.http.routers.shumiland.tls.certresolver=cloudflare
- traefik.http.services.shumiland.loadbalancer.server.port=3000
- traefik.http.routers.shumiland.middlewares=security-headers@file
pg_backup:
image: alpine:3
volumes:
- postgres_data:/var/lib/postgresql/data:ro
- ./backups:/backups
environment:
POSTGRES_USER: shumiland
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: shumiland
POSTGRES_HOST: postgres
command: >-
sh -c "apk add --no-cache postgresql-client &&
echo '0 3 * * * pg_dump postgresql://$$POSTGRES_USER:$$POSTGRES_PASSWORD@$$POSTGRES_HOST/$$POSTGRES_DB | gzip > /backups/shumiland_$$(date +\%Y\%m\%d_\%H\%M\%S).sql.gz && find /backups -mtime +14 -delete' | crontab - &&
crond -f"
depends_on:
- postgres
restart: unless-stopped
networks:
- internal
networks:
internal:
name: shumiland-internal
traefik-public:
external: true
volumes:
postgres_data:
name: shumiland-postgres-data
media_uploads:
name: shumiland-media-uploads