Files
PolyWeather/docker-compose.yml
T
2026-05-26 01:04:20 +08:00

69 lines
2.5 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
polyweather_frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: polyweather_frontend
restart: unless-stopped
ports:
- "3000:3000"
environment:
POLYWEATHER_API_BASE_URL: "${POLYWEATHER_API_BASE_URL:-http://polyweather_web:8000}"
NEXT_PUBLIC_POLYWEATHER_API_BASE_URL: "${NEXT_PUBLIC_POLYWEATHER_API_BASE_URL:-}"
NEXT_PUBLIC_SUPABASE_URL: "${NEXT_PUBLIC_SUPABASE_URL}"
NEXT_PUBLIC_SUPABASE_ANON_KEY: "${NEXT_PUBLIC_SUPABASE_ANON_KEY}"
NEXT_PUBLIC_SITE_URL: "${NEXT_PUBLIC_SITE_URL:-https://38.54.27.70.sslip.io}"
POLYWEATHER_AUTH_ENABLED: "${POLYWEATHER_AUTH_ENABLED:-true}"
POLYWEATHER_AUTH_REQUIRED: "${POLYWEATHER_AUTH_REQUIRED:-true}"
NEXT_PUBLIC_POLYWEATHER_LOCAL_FULL_ACCESS: "false"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000"]
interval: 30s
timeout: 5s
retries: 3