81 lines
2.2 KiB
YAML
81 lines
2.2 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}
|
|
APP_VERSION: ${APP_VERSION:-0.1.0}
|
|
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}
|
|
APP_VERSION: ${APP_VERSION:-0.1.0}
|
|
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-1}
|
|
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: ${WEB_DOCKERFILE:-infra/docker/web.Dockerfile}
|
|
args:
|
|
NGINX_CONF: ${WEB_NGINX_CONF:-infra/docker/nginx.conf}
|
|
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
|