1
0
Fork 0
polaris-task-force/docker-compose.yml

66 lines
No EOL
2.2 KiB
YAML

# Local full-stack dev compose.
#
# `docker compose up --build` boots the Next.js + Payload app next to a
# dedicated Postgres and mounts `./media` as the Payload upload volume, so
# you get the exact same shape as the Coolify deployment without needing a
# running Coolify cluster.
#
# In production (Coolify) we DO NOT use this file — Coolify builds the
# Dockerfile directly per environment and provisions its own managed
# PostgreSQL service. DATABASE_URI is injected as an env var per
# environment by Coolify. See DEPLOYMENT.md.
services:
app:
build:
context: .
dockerfile: Dockerfile
image: polaris-task-force:local
container_name: polaris-task-force-app
# In Coolify these come from the per-environment env vars configured in
# the Coolify UI; here we read a local .env (see .env.example).
env_file:
- .env
environment:
# Override the host DB hostname with the compose service name so
# the app reaches the bundled postgres instead of localhost.
# DATABASE_URI is rewritten below — strip any user-provided value.
NODE_ENV: production
DATABASE_URI: postgres://${POSTGRES_USER:-ptfapp}:${POSTGRES_PASSWORD:-polaristaskforcedb}@postgres:5432/${POSTGRES_DB:-ptf-app-dev}
ports:
- "${APP_PORT:-3000}:3000"
volumes:
# Persist Payload uploads between rebuilds locally.
- ./media:/app/media
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/api/health"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
restart: unless-stopped
postgres:
image: postgres:17-alpine
container_name: polaris-task-force-pg
environment:
POSTGRES_USER: ${POSTGRES_USER:-ptfapp}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-polaristaskforcedb}
POSTGRES_DB: ${POSTGRES_DB:-ptf-app-dev}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ptfapp} -d ${POSTGRES_DB:-ptf-app-dev}"]
interval: 10s
timeout: 5s
start_period: 10s
retries: 5
restart: unless-stopped
volumes:
pgdata: