fix: run migrations from build stage (has pnpm)
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>
This commit is contained in:
parent
2c115bab99
commit
ecc2c94e5f
2 changed files with 15 additions and 2 deletions
|
|
@ -255,8 +255,8 @@ start_containers() {
|
|||
run_migrations() {
|
||||
header "Phase 5 — Database migrations"
|
||||
|
||||
log "Running Payload CMS migrations..."
|
||||
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" exec -T app pnpm payload migrate
|
||||
log "Running Payload CMS migrations (via build stage — has pnpm + full node_modules)..."
|
||||
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" --profile migrate run --rm migrator
|
||||
log "Migrations complete."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,19 @@ services:
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue