fix: add setup service for db push/seed; update README
The production runner image has no node_modules, so prisma CLI and tsx are unavailable. Add a Compose 'setup' profile service that uses the builder stage (which has all dev tools) to run db push and db seed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,5 +33,23 @@ services:
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
# First-run setup: applies the schema and seeds the user.
|
||||
# Uses the builder stage so all dev tools (prisma CLI, tsx, bcryptjs) are available.
|
||||
# Run once with: docker compose --profile setup run --rm setup
|
||||
setup:
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
command: sh -c "npx prisma db push && npx prisma db seed"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
SEED_EMAIL: ${SEED_EMAIL}
|
||||
SEED_PASSWORD: ${SEED_PASSWORD}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
profiles:
|
||||
- setup
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user