76 lines
1.8 KiB
YAML
76 lines
1.8 KiB
YAML
services:
|
|
db:
|
|
image: postgres:17-alpine
|
|
container_name: shop-db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-shop}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-shop_secret}
|
|
POSTGRES_DB: ${DB_NAME:-shop}
|
|
TZ: ${TZ:-UTC}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./migrations/001_init.sql:/docker-entrypoint-initdb.d/001_init.sql:ro
|
|
- ./migrations/002_admins.sql:/docker-entrypoint-initdb.d/002_admins.sql:ro
|
|
- ./migrations/003_admin_features.sql:/docker-entrypoint-initdb.d/003_admin_features.sql:ro
|
|
- ./migrations/004_users_cart_orders.sql:/docker-entrypoint-initdb.d/004_users_cart_orders.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-shop} -d ${DB_NAME:-shop}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
networks:
|
|
- shop-net
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: shop-app
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
DB_HOST: db
|
|
DB_PORT: "5432"
|
|
APP_PORT: "8080"
|
|
UPLOAD_DIR: /app/data/uploads
|
|
volumes:
|
|
- uploads:/app/data/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- shop-net
|
|
init: true
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
container_name: shop-caddy
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
env_file: .env
|
|
environment:
|
|
DOMAIN: ${DOMAIN:-localhost}
|
|
CADDY_EMAIL: ${CADDY_EMAIL:-}
|
|
volumes:
|
|
- ${CADDYFILE:-./Caddyfile}:/etc/caddy/Caddyfile:ro
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
depends_on:
|
|
- app
|
|
networks:
|
|
- shop-net
|
|
init: true
|
|
|
|
volumes:
|
|
pgdata:
|
|
uploads:
|
|
caddy_data:
|
|
caddy_config:
|
|
|
|
networks:
|
|
shop-net:
|
|
driver: bridge
|