63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
version: '3.9'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: experiments_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-expuser}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-exppassword}
|
|
POSTGRES_DB: ${POSTGRES_DB:-experiments_db}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
# Port NOT exposed to host — only reachable by backend via internal Docker network
|
|
expose:
|
|
- "5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-expuser} -d ${POSTGRES_DB:-experiments_db}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
target: prod
|
|
container_name: experiments_backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-expuser}:${POSTGRES_PASSWORD:-exppassword}@postgres:5432/${POSTGRES_DB:-experiments_db}
|
|
NODE_ENV: production
|
|
PORT: 3001
|
|
CORS_ORIGIN: "http://localhost:52867"
|
|
# Run as non-root
|
|
user: "node"
|
|
entrypoint: ["/bin/sh", "/app/docker-entrypoint.sh"]
|
|
ports:
|
|
- "3001:3001"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost:3001/health || exit 1"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
target: prod
|
|
container_name: experiments_frontend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
ports:
|
|
- "52867:80"
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: experiments_postgres_data
|