Files
PolyWeather/docker-compose.yml
T
2026-05-25 22:31:42 +08:00

46 lines
1.6 KiB
YAML

x-polyweather-base: &polyweather-base
build: .
image: polyweather-app:latest
env_file:
- .env
services:
polyweather:
<<: *polyweather-base
container_name: polyweather_bot
restart: unless-stopped
cpus: "${POLYWEATHER_BOT_CPUS:-0.75}"
mem_limit: "${POLYWEATHER_BOT_MEM_LIMIT:-768m}"
memswap_limit: "${POLYWEATHER_BOT_MEMSWAP_LIMIT:-1g}"
pids_limit: 256
environment:
TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC: "${POLYWEATHER_BOT_AIRPORT_PUSH_INTERVAL_SEC:-180}"
TELEGRAM_AIRPORT_PUSH_MAX_WORKERS: "${POLYWEATHER_BOT_AIRPORT_PUSH_MAX_WORKERS:-1}"
volumes:
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/app/data
- ./bot.log:/app/bot.log
user: "${UID:-1000}:${GID:-1000}"
healthcheck:
test: ["CMD", "python", "-c", "import sqlite3; c=sqlite3.connect('/var/lib/polyweather/polyweather.db'); c.execute('SELECT 1'); c.close()"]
interval: 60s
timeout: 10s
retries: 3
polyweather_web:
<<: *polyweather-base
container_name: polyweather_web
restart: unless-stopped
command: python web/app.py
volumes:
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/app/data
ports:
- "8000:8000"
user: "${UID:-1000}:${GID:-1000}"
healthcheck:
test: ["CMD", "python", "-c", "from urllib.request import urlopen; urlopen('http://localhost:8000/healthz')"]
interval: 30s
timeout: 5s
retries: 3