Files
nick-sde-value-driver-website/docker-compose.yml
2026-07-22 15:54:59 -05:00

48 lines
1.5 KiB
YAML

# One command to run the whole thing internally: docker compose up -d
# The app comes up on http://<host>:3000
services:
db:
image: postgres:16-alpine
restart: unless-stopped
# Username / password / db name come from your .env (or the defaults below),
# so you change them in one place and both services stay in sync.
environment:
POSTGRES_USER: ${DB_USER:-sde}
POSTGRES_PASSWORD: ${DB_PASSWORD:-sde_password}
POSTGRES_DB: ${DB_NAME:-sde_toolkit}
# Publish the DB to the host so `npm run dev` (running outside Docker) can
# reach it. Host port comes from DB_PORT in .env; inside Docker it's 5432.
ports:
- "${DB_PORT:-5432}:5432"
volumes:
- db_data:/var/lib/postgresql/data
# Runs once on first startup to create the schema.
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-sde} -d ${DB_NAME:-sde_toolkit}"]
interval: 5s
timeout: 5s
retries: 10
app:
build: .
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
# "db" is the hostname of the database service above, on the compose network.
DB_HOST: db
DB_PORT: 5432
DB_USER: ${DB_USER:-sde}
DB_PASSWORD: ${DB_PASSWORD:-sde_password}
DB_NAME: ${DB_NAME:-sde_toolkit}
PORT: 3000
ORIGIN: ${ORIGIN:-http://localhost:3000}
ports:
- "3000:3000"
volumes:
db_data: