Files
sbnews/docker/docker-compose.prod.yml
T

147 lines
3.9 KiB
YAML

name: sport-era-prod
x-logging: &default-logging
driver: json-file
options:
max-size: "20m"
max-file: "5"
x-php-service: &php-service
image: sport-era-prod-php:local
build:
context: ..
dockerfile: docker/Dockerfile.php
restart: unless-stopped
network_mode: host
working_dir: /likeadmin_php/server
environment:
TZ: Asia/Shanghai
volumes:
- ${SERVER_DIR:-../server}:/likeadmin_php/server
- ${SERVER_ENV_FILE:-./.env.server.production}:/likeadmin_php/server/.env:ro
- ./config/php/conf.d/zz-opcache.prod.ini:/usr/local/etc/php/conf.d/zz-opcache.ini:ro
- ./config/php/php-fpm.prod.conf:/usr/local/etc/php-fpm.d/zz-production.conf:ro
logging: *default-logging
x-crawler-service: &crawler-service
image: sport-era-prod-crawler:local
build:
context: ${CRAWLER_DIR:-./crawler}
dockerfile: Dockerfile
restart: unless-stopped
network_mode: host
env_file:
- ${CRAWLER_ENV_FILE:-./.env.crawler.production}
environment:
TZ: Asia/Shanghai
DQD_CONFIG_PATH: /app/config/settings.yaml
DQD_TASKS_FILE: /app/config/crawler_tasks.yaml
DQD_LOCK_DIR: /app/data/locks
DQD_DB_HOST: 127.0.0.1
DQD_REDIS_HOST: 127.0.0.1
volumes:
- ${CRAWLER_DIR:-./crawler}/logs:/app/logs
- ${CRAWLER_DIR:-./crawler}/data:/app/data
logging: *default-logging
services:
server:
<<: *php-service
healthcheck:
test:
- CMD-SHELL
- >-
php -r '$$socket=@fsockopen("127.0.0.1",9000,$$errno,$$errstr,2);
exit($$socket ? 0 : 1);'
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
scheduler:
<<: *php-service
# Reuse the server PHP image; building the same tag concurrently causes
# BuildKit export collisions during a full production bootstrap.
build: null
command:
- sh
- -c
- while true; do php think crontab; sleep 60; done
crawler:
<<: *crawler-service
kb-worker:
<<: *crawler-service
# Reuse the crawler image built by the crawler service.
build: null
command:
- python
- scripts/kb_worker.py
- --batch=50
- --block-ms=5000
- --max-retries=3
api-nginx:
image: registry.cn-guangzhou.aliyuncs.com/likeadmin/nginx:1.23.1
restart: unless-stopped
network_mode: host
depends_on:
server:
condition: service_healthy
volumes:
- ${SERVER_DIR:-../server}:/likeadmin_php/server:ro
- ./config/nginx/conf.d/sport-era.prod-api.conf:/etc/nginx/conf.d/default.conf:ro
- ./log/nginx/prod-logs:/logs
healthcheck:
test:
- CMD-SHELL
- wget -qO- http://127.0.0.1:8000/healthz | grep -q '^ok$'
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
logging: *default-logging
admin:
image: sport-era-prod-admin:local
build:
context: ../admin
dockerfile: ../docker/Dockerfile.admin
args:
VITE_APP_BASE_URL: ${PROD_API_BASE_URL:-https://api.sbnews.net}
restart: unless-stopped
network_mode: host
volumes:
- ./config/nginx/static/admin.conf:/etc/nginx/conf.d/default.conf:ro
healthcheck:
test:
- CMD-SHELL
- wget -qO- http://127.0.0.1:5176/healthz | grep -q '^ok$'
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
logging: *default-logging
uniapp-h5:
image: sport-era-prod-uniapp-h5:local
build:
context: ../uniapp
dockerfile: ../docker/Dockerfile.uniapp-h5
args:
VITE_APP_BASE_URL: ${PROD_API_BASE_URL:-https://api.sbnews.net}
restart: unless-stopped
network_mode: host
volumes:
- ./config/nginx/static/uniapp-h5.conf:/etc/nginx/conf.d/default.conf:ro
healthcheck:
test:
- CMD-SHELL
- wget -qO- http://127.0.0.1:5177/healthz | grep -q '^ok$'
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
logging: *default-logging