97 lines
2.7 KiB
YAML
97 lines
2.7 KiB
YAML
|
|
# Nexus 6.0 鈥?Docker Compose (dev / staging)
|
||
|
|
# Usage:
|
||
|
|
# cp docker/.env.example docker/.env # or: python docker/generate_env.py
|
||
|
|
# docker compose --env-file docker/.env up -d --build
|
||
|
|
# open http://localhost:18600/app/
|
||
|
|
|
||
|
|
name: nexus
|
||
|
|
|
||
|
|
services:
|
||
|
|
mysql:
|
||
|
|
image: mysql:8.4
|
||
|
|
restart: unless-stopped
|
||
|
|
environment:
|
||
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-nexus_root_dev}
|
||
|
|
MYSQL_DATABASE: nexus
|
||
|
|
MYSQL_USER: nexus
|
||
|
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-nexus_dev_pass}
|
||
|
|
volumes:
|
||
|
|
- mysql-data:/var/lib/mysql
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p\"$$MYSQL_ROOT_PASSWORD\" || exit 1"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 8
|
||
|
|
start_period: 40s
|
||
|
|
ports:
|
||
|
|
- "${MYSQL_PUBLISH_PORT:-13306}:3306"
|
||
|
|
|
||
|
|
redis:
|
||
|
|
image: redis:7-alpine
|
||
|
|
restart: unless-stopped
|
||
|
|
command: ["redis-server", "--appendonly", "yes"]
|
||
|
|
volumes:
|
||
|
|
- redis-data:/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "redis-cli", "ping"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 3s
|
||
|
|
retries: 8
|
||
|
|
ports:
|
||
|
|
- "${REDIS_PUBLISH_PORT:-16379}:6379"
|
||
|
|
|
||
|
|
nexus:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
network: host
|
||
|
|
args:
|
||
|
|
DEBIAN_MIRROR: https://mirrors.aliyun.com/debian
|
||
|
|
DEBIAN_SECURITY_MIRROR: https://mirrors.aliyun.com/debian-security
|
||
|
|
PIP_INDEX_URL: https://mirrors.aliyun.com/pypi/simple/
|
||
|
|
PIP_TRUSTED_HOST: mirrors.aliyun.com
|
||
|
|
restart: unless-stopped
|
||
|
|
depends_on:
|
||
|
|
mysql:
|
||
|
|
condition: service_healthy
|
||
|
|
redis:
|
||
|
|
condition: service_healthy
|
||
|
|
ports:
|
||
|
|
- "${NEXUS_PUBLISH_PORT:-18600}:8600"
|
||
|
|
environment:
|
||
|
|
MYSQL_HOST: mysql
|
||
|
|
MYSQL_PORT: "3306"
|
||
|
|
REDIS_HOST: redis
|
||
|
|
REDIS_PORT: "6379"
|
||
|
|
NEXUS_PERSIST_DIR: /var/lib/nexus
|
||
|
|
NEXUS_DOCKER_WRITE_ENV: "1"
|
||
|
|
NEXUS_HOST: "0.0.0.0"
|
||
|
|
NEXUS_PORT: "8600"
|
||
|
|
NEXUS_DEPLOY_PATH: /app
|
||
|
|
NEXUS_DATABASE_URL: mysql+aiomysql://nexus:${MYSQL_PASSWORD:-nexus_dev_pass}@mysql:3306/nexus
|
||
|
|
NEXUS_REDIS_URL: redis://redis:6379/0
|
||
|
|
NEXUS_CORS_ORIGINS: ${NEXUS_CORS_ORIGINS:-http://localhost:18600,http://127.0.0.1:18600,http://localhost:8600,http://127.0.0.1:8600}
|
||
|
|
NEXUS_SECRET_KEY: ${NEXUS_SECRET_KEY:-}
|
||
|
|
NEXUS_API_KEY: ${NEXUS_API_KEY:-}
|
||
|
|
NEXUS_ENCRYPTION_KEY: ${NEXUS_ENCRYPTION_KEY:-}
|
||
|
|
NEXUS_API_BASE_URL: ${NEXUS_API_BASE_URL:-http://localhost:18600}
|
||
|
|
env_file:
|
||
|
|
- path: docker/.env
|
||
|
|
required: false
|
||
|
|
volumes:
|
||
|
|
- nexus-state:/var/lib/nexus
|
||
|
|
- nexus-web-data:/app/web/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8600/health"]
|
||
|
|
interval: 30s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
start_period: 90s
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
mysql-data:
|
||
|
|
redis-data:
|
||
|
|
nexus-state:
|
||
|
|
nexus-web-data:
|
||
|
|
|