db4bc9bfe1
Co-authored-by: Cursor <cursoragent@cursor.com>
75 lines
1.7 KiB
YAML
75 lines
1.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: shop-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-shop}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-shop}
|
|
POSTGRES_DB: ${POSTGRES_DB:-shop}
|
|
volumes:
|
|
- shop_pg_data:/var/lib/postgresql/data
|
|
- ./postgres/init:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB']
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 10s
|
|
networks:
|
|
- shop
|
|
|
|
app:
|
|
build: .
|
|
container_name: shop-app
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
NODE_ENV: production
|
|
HOST: 0.0.0.0
|
|
PORT: 3000
|
|
TRUST_PROXY: ${TRUST_PROXY:-0}
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-shop}:${POSTGRES_PASSWORD:-shop}@postgres:5432/${POSTGRES_DB:-shop}
|
|
ports:
|
|
- '${APP_PORT:-3000}:3000'
|
|
healthcheck:
|
|
test: ['CMD', 'curl', '-f', 'http://127.0.0.1:3000/health']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 15s
|
|
networks:
|
|
- shop
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
container_name: shop-caddy
|
|
profiles:
|
|
- proxy
|
|
restart: unless-stopped
|
|
depends_on:
|
|
app:
|
|
condition: service_healthy
|
|
ports:
|
|
- '80:80'
|
|
- '443:443'
|
|
volumes:
|
|
- ./caddy/Caddyfile.docker.example:/etc/caddy/Caddyfile:ro
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
networks:
|
|
- shop
|
|
|
|
networks:
|
|
shop:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
shop_pg_data:
|
|
caddy_data:
|
|
caddy_config:
|