Runner stage is minimal — no pnpm. Add migrator service using build target which has full node_modules + pnpm. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
843 B
YAML
44 lines
843 B
YAML
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
target: runner
|
|
restart: always
|
|
ports:
|
|
- '127.0.0.1:3000:3000'
|
|
env_file:
|
|
- .env.production
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
|
|
migrator:
|
|
build:
|
|
context: .
|
|
target: build
|
|
command: pnpm payload migrate
|
|
env_file:
|
|
- .env.production
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
profiles:
|
|
- migrate
|
|
|
|
db:
|
|
image: postgres:17-alpine
|
|
restart: always
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-axil}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: ${DB_NAME:-axil}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U ${DB_USER:-axil}']
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
volumes:
|
|
pgdata:
|