ff6c8d6bd9
添加了.env.example配置文件,包含PostgreSQL、Redis、MinIO/S3、 服务器和前端构建等完整的环境变量配置。 同时优化了docker-compose.yml文件中的环境变量引用方式, 移除了默认值设置,改为统一从环境变量中读取配置值, 提高了配置的灵活性和安全性
160 lines
3.7 KiB
YAML
160 lines
3.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgis/postgis:17-3.5
|
|
container_name: ciyuan-postgres
|
|
environment:
|
|
POSTGRES_USER: "${POSTGRES_USER}"
|
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
|
|
POSTGRES_DB: "${POSTGRES_DB}"
|
|
PGDATA: "${POSTGRES_PGDATA}"
|
|
expose:
|
|
- "5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./pg_backup:/backups
|
|
- ./docker/postgres/init:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: ciyuan-redis
|
|
expose:
|
|
- "6379"
|
|
volumes:
|
|
- redisdata:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: ciyuan-minio
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: "${MINIO_ROOT_USER}"
|
|
MINIO_ROOT_PASSWORD: "${MINIO_ROOT_PASSWORD}"
|
|
expose:
|
|
- "9000"
|
|
- "9001"
|
|
volumes:
|
|
- miniodata:/data
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
server:
|
|
build:
|
|
context: ./server
|
|
container_name: ciyuan-server
|
|
environment:
|
|
DATABASE_URL: "${DATABASE_URL}"
|
|
DATABASE_URL_SYNC: "${DATABASE_URL_SYNC}"
|
|
REDIS_URL: "${REDIS_URL}"
|
|
SECRET_KEY: "${SECRET_KEY}"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: "${ACCESS_TOKEN_EXPIRE_MINUTES}"
|
|
REFRESH_TOKEN_EXPIRE_DAYS: "${REFRESH_TOKEN_EXPIRE_DAYS}"
|
|
STORAGE_BACKEND: "${STORAGE_BACKEND}"
|
|
LOCAL_STORAGE_PATH: "${LOCAL_STORAGE_PATH}"
|
|
S3_ENDPOINT: "${S3_ENDPOINT}"
|
|
S3_ACCESS_KEY: "${S3_ACCESS_KEY}"
|
|
S3_SECRET_KEY: "${S3_SECRET_KEY}"
|
|
S3_BUCKET: "${S3_BUCKET}"
|
|
TENCENT_MAP_KEY: "${TENCENT_MAP_KEY}"
|
|
LOG_LEVEL: "${LOG_LEVEL}"
|
|
LOG_JSON: "${LOG_JSON}"
|
|
expose:
|
|
- "8000"
|
|
volumes:
|
|
- server_uploads:/app/uploads
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_started
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"python",
|
|
"-c",
|
|
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=5)",
|
|
]
|
|
interval: 15s
|
|
timeout: 10s
|
|
retries: 10
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
admin-web:
|
|
build:
|
|
context: ./admin-web
|
|
args:
|
|
VITE_API_BASE: "${VITE_API_BASE}"
|
|
container_name: ciyuan-admin-web
|
|
expose:
|
|
- "80"
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
clients:
|
|
build:
|
|
context: ./clients
|
|
container_name: ciyuan-clients
|
|
expose:
|
|
- "80"
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
nginx:
|
|
image: nginx:1.27-alpine
|
|
container_name: ciyuan-nginx
|
|
ports:
|
|
- "${CLIENT_WEB_PORT}:80"
|
|
- "${ADMIN_WEB_PORT}:81"
|
|
volumes:
|
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
admin-web:
|
|
condition: service_started
|
|
clients:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
networks:
|
|
- ciyuan-net
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|
|
miniodata:
|
|
server_uploads:
|
|
|
|
networks:
|
|
ciyuan-net:
|
|
driver: bridge
|