50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
# Run the prod-built app in a container, pulling env vars from .env.local
|
|
# (if present) or from the shell. No build-time secrets — every env value is
|
|
# read at container start by Next's standalone server.
|
|
#
|
|
# Usage:
|
|
# docker compose up --build
|
|
# APP_PORT=8080 docker compose up (override host port)
|
|
#
|
|
# Compose v2.24+ (required for `env_file: path/required` syntax).
|
|
|
|
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: places:latest
|
|
container_name: places
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
|
|
# Env vars are loaded from .env.local at container start.
|
|
# `required: false` lets compose run even if the file is missing — useful
|
|
# when vars are injected by an external system (CI, K8s secrets, etc).
|
|
env_file:
|
|
- path: .env.local
|
|
required: false
|
|
|
|
# Explicit values that always apply (these win over .env.local).
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: "3000"
|
|
HOSTNAME: "0.0.0.0"
|
|
PGHOST: 103.188.82.191
|
|
PGUSER: renolation
|
|
PGPASSWORD: renolation
|
|
PGDATABASE: places_db
|
|
PGPORT: "5432"
|
|
|
|
healthcheck:
|
|
test:
|
|
- "CMD"
|
|
- "node"
|
|
- "-e"
|
|
- "fetch('http://localhost:3000/login').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|