9797519e5c
Bind-mounting ./data/uploads caused EACCES errors because Docker creates the host directory as root, while the container runs as nextjs (UID 1001). A named volume is initialized from the image where chown is already set correctly.
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-ecommerce}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ecommerce_password}
|
|
POSTGRES_DB: ${POSTGRES_DB:-ecommerce}
|
|
volumes:
|
|
- ./data/db:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ecommerce"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
app:
|
|
build:
|
|
context: ./app
|
|
dockerfile: Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
env_file: .env
|
|
environment:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-ecommerce}:${POSTGRES_PASSWORD:-ecommerce_password}@db:5432/${POSTGRES_DB:-ecommerce}
|
|
expose:
|
|
- "3000"
|
|
volumes:
|
|
- uploads:/app/public/uploads
|
|
|
|
mailpit:
|
|
image: axllent/mailpit:latest
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8025:8025"
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
|
- ./data/caddy/data:/data
|
|
- ./data/caddy/config:/config
|
|
- uploads:/srv/uploads
|
|
depends_on:
|
|
- app
|
|
|
|
volumes:
|
|
uploads:
|