Files
ip-geo-api/docker-compose.yml
Mateusz Gruszczyński 2a281f6b44 praca za proxy
2025-10-06 09:47:26 +02:00

57 lines
1.2 KiB
YAML

services:
api:
build: .
container_name: ip-geo-api
restart: unless-stopped
ports:
- "${PORT:-8080}:${PORT}"
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; import sys; req = urllib.request.Request('http://localhost:${PORT}/health'); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
command:
[
"uvicorn",
"app.main:app",
"--host",
"0.0.0.0",
"--port",
"${PORT}",
"--log-config",
"logging.yml",
"--proxy-headers",
"--forwarded-allow-ips=*",
]
volumes:
- ./data:/data
env_file:
- .env
networks:
- ip-geo-api_network
depends_on:
- updater
updater:
build: .
container_name: ip-geo-updater
restart: unless-stopped
volumes:
- ./data:/data
command: ["python", "-m", "scripts.updater"]
environment:
- PYTHONPATH=/app
env_file:
- .env
networks:
ip-geo-api_network:
driver: bridge