91 lines
2.4 KiB
YAML
91 lines
2.4 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: family_budget_db
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
ports:
|
|
- "${POSTGRES_PORT}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
image: ghcr.io/${OWNER:-${COMPOSE_PROJECT_NAME}}/family_budget-backend:latest
|
|
container_name: family_budget_backend
|
|
environment:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
|
RUST_LOG: ${RUST_LOG:-info}
|
|
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:5173}
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
image: ghcr.io/${OWNER:-${COMPOSE_PROJECT_NAME}}/family_budget-frontend:latest
|
|
container_name: family_budget_frontend
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: family_budget_nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
|
- certbot_www:/var/www/certbot:ro
|
|
- certbot_conf:/etc/letsencrypt:ro
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
networks:
|
|
- app_network
|
|
restart: unless-stopped
|
|
|
|
certbot:
|
|
image: certbot/certbot
|
|
container_name: family_budget_certbot
|
|
volumes:
|
|
- certbot_www:/var/www/certbot:rw
|
|
- certbot_conf:/etc/letsencrypt:rw
|
|
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
|
|
|
watchtower:
|
|
image: containrrr/watchtower
|
|
container_name: family_budget_watchtower
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- ./docker-config.json:/config.json:ro
|
|
environment:
|
|
- WATCHTOWER_POLL_INTERVAL=300
|
|
- WATCHTOWER_CLEANUP=true
|
|
- WATCHTOWER_INCLUDE_RESTARTING=true
|
|
- WATCHTOWER_ROLLING_RESTART=true
|
|
- WATCHTOWER_LABEL_ENABLE=false
|
|
command: family_budget_backend family_budget_frontend
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
certbot_www:
|
|
driver: local
|
|
certbot_conf:
|
|
driver: local
|
|
|
|
networks:
|
|
app_network:
|
|
driver: bridge
|