Files
rogaining_srv/docker-compose-prod.yaml
2025-08-25 14:28:30 +09:00

79 lines
2.0 KiB
YAML

services:
postgres-db:
image: kartoza/postgis:12.0
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql
- ./custom-postgresql.conf:/etc/postgresql/12/main/postgresql.conf
- ./rogaining.sql:/sql/rogaining.sql
- ./sqls:/sqls
- ./create_location2025_table.sql:/sql/create_location2025_table.sql
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- POSTGRES_DBNAME=${POSTGRES_DBNAME}
- POSTGRES_MAX_CONNECTIONS=600
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
restart: "on-failure"
networks:
- rog-api
app:
build:
context: .
dockerfile: Dockerfile.gdal
command: bash -c "./wait-for-postgres.sh postgres-db && gunicorn config.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/app
- static_volume:/app/static
- media_volume:/app/media
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000')\" || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: "on-failure"
depends_on:
postgres-db:
condition: service_healthy
networks:
- rog-api
nginx:
image: nginx:1.19
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- static_volume:/app/static
- media_volume:/app/media
- ./supervisor/html:/usr/share/nginx/html
ports:
- 8100:80
depends_on:
- app
networks:
- rog-api
networks:
rog-api:
driver: bridge
volumes:
postgres_data:
static_volume:
media_volume: