chore: 增加隔离的本地Docker测试编排
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
name: artveris-local
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?Required}
|
||||
MYSQL_DATABASE: artveris_test
|
||||
MYSQL_USER: artveris
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?Required}
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'MYSQL_PWD="$${MYSQL_ROOT_PASSWORD}" mysql -uroot -e "SELECT 1"']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:?Required}
|
||||
command: [sh, -c, 'exec redis-server --appendonly yes --requirepass "$${REDIS_PASSWORD}"']
|
||||
volumes:
|
||||
- redis:/data
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'REDISCLI_AUTH="$${REDIS_PASSWORD}" redis-cli ping']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
api:
|
||||
image: artveris-api:local
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.api
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
API_PORT: 3000
|
||||
ARTVERIS_ENV_FILE: /app/apps/api/config/.env
|
||||
ARTVERIS_OUTBOUND_TEMP_DIR: /app/apps/api/tmp
|
||||
TIANHE_BASE_URL: https://test.api.tichain.tianhecloud.com
|
||||
# Local tests must never reach the paid production chain, even if settings change.
|
||||
extra_hosts:
|
||||
- "api.tichain.tianhecloud.com:127.0.0.1"
|
||||
volumes:
|
||||
- ../.deploy/local/config:/app/apps/api/config
|
||||
- ../.deploy/local/storage:/app/apps/api/storage
|
||||
- ../.deploy/local/backups:/app/apps/api/backups
|
||||
- ../.deploy/local/tmp:/app/apps/api/tmp
|
||||
healthcheck:
|
||||
test: [CMD, node, -e, "fetch('http://127.0.0.1:3000/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
start_period: 60s
|
||||
retries: 5
|
||||
web:
|
||||
image: nginx:alpine
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- api
|
||||
ports:
|
||||
- "127.0.0.1:18080:80"
|
||||
volumes:
|
||||
- ./nginx.local.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
volumes:
|
||||
mysql:
|
||||
redis:
|
||||
Reference in New Issue
Block a user