Files
xiaoxia-saas/infra/docker/compose.yml
T
2026-06-21 12:34:51 +08:00

76 lines
2.0 KiB
YAML

services:
api:
image: ${API_IMAGE:-xiaoxia-saas-api:dev}
build:
context: ../..
dockerfile: infra/docker/api.Dockerfile
container_name: xiaoxia-api-${ENV:-staging}
restart: unless-stopped
env_file:
- ../../.env
environment:
APP_ENV: ${APP_ENV:-staging}
GENERATED_FILES_DIR: /app/generated
GENERATED_FILES_URL_PREFIX: /generated-files
PUBLIC_API_BASE_URL: ${PUBLIC_API_BASE_URL:-https://api.xiaoxiajianji.com}
ports:
- "${API_PORT:-8000}:8000"
volumes:
- generated-files:/app/generated
networks:
- xiaoxia-net
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health', timeout=5)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
worker:
image: ${WORKER_IMAGE:-xiaoxia-saas-worker:dev}
build:
context: ../..
dockerfile: infra/docker/worker.Dockerfile
container_name: xiaoxia-worker-${ENV:-staging}
restart: unless-stopped
env_file:
- ../../.env
environment:
APP_ENV: ${APP_ENV:-staging}
GENERATED_FILES_DIR: /app/generated
GENERATED_FILES_URL_PREFIX: /generated-files
PUBLIC_API_BASE_URL: ${PUBLIC_API_BASE_URL:-https://api.xiaoxiajianji.com}
volumes:
- generated-files:/app/generated
networks:
- xiaoxia-net
web:
image: ${WEB_IMAGE:-xiaoxia-saas-web:dev}
build:
context: ../..
dockerfile: infra/docker/web.Dockerfile
container_name: xiaoxia-web-${ENV:-staging}
restart: unless-stopped
ports:
- "${WEB_PORT:-3001}:80"
networks:
- xiaoxia-net
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:80"]
interval: 30s
timeout: 5s
retries: 3
volumes:
generated-files:
driver: local
driver_opts:
type: none
o: bind
device: ${GENERATED_FILES_HOST_DIR:-/var/lib/xiaoxia-saas-staging/generated}
networks:
xiaoxia-net:
external: true