freealberta/freealberta-food/docker-compose.yml

81 lines
1.9 KiB
YAML

services:
app:
build:
context: ./app
dockerfile: Dockerfile
container_name: freealberta-food-app
ports:
- "${FOOD_PORT:-3003}:3003"
env_file:
- .env
environment:
- NODE_ENV=production
- PORT=3003
- DB_HOST=food-db
- DB_PORT=5432
- DB_NAME=freealberta_food
- ENABLE_CRON=true
volumes:
- ./app:/usr/src/app
- /usr/src/app/node_modules
- food-logs:/usr/src/app/logs
restart: always
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3003/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
networks:
- changemaker-lite-freealberta
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
depends_on:
food-db:
condition: service_healthy
food-db:
image: postgres:17-alpine
container_name: freealberta-food-db
restart: unless-stopped
environment:
POSTGRES_USER: ${FOOD_DB_USER:-foodadmin}
POSTGRES_PASSWORD: ${FOOD_DB_PASSWORD:-changeme}
POSTGRES_DB: freealberta_food
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${FOOD_DB_USER:-foodadmin} -d freealberta_food"]
interval: 10s
timeout: 5s
retries: 6
volumes:
- food-db-data:/var/lib/postgresql/data
networks:
- changemaker-lite-freealberta
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
volumes:
food-logs:
driver: local
food-db-data:
driver: local
networks:
changemaker-lite-freealberta:
name: changemaker-lite-freealberta_changemaker-lite-freealberta
external: true