120 lines
3.6 KiB
YAML
120 lines
3.6 KiB
YAML
version: '3.8'
|
|
|
|
# ============================================
|
|
# FLNXI素材库 - 标准版配置(统一存储桶方案)
|
|
# 与 Pro 版一致:所有素材统一写入 MinIO/S3
|
|
# ============================================
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: youyidian-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-youyidian123456}
|
|
POSTGRES_DB: ${POSTGRES_DB:-flnxi}
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- app-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
minio:
|
|
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
|
|
container_name: youyidian-minio
|
|
restart: unless-stopped
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123456}
|
|
volumes:
|
|
- minio_data:/data
|
|
ports:
|
|
- "${MINIO_API_PORT:-9000}:9000"
|
|
- "${MINIO_CONSOLE_PORT:-9001}:9001"
|
|
networks:
|
|
- app-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
|
|
minio-init:
|
|
image: minio/mc:latest
|
|
container_name: youyidian-minio-init
|
|
depends_on:
|
|
minio:
|
|
condition: service_healthy
|
|
entrypoint: >
|
|
/bin/sh -c "
|
|
sleep 5;
|
|
mc alias set myminio http://minio:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin123456};
|
|
mc mb myminio/${S3_BUCKET:-youyidian3d} --ignore-existing;
|
|
mc anonymous set download myminio/${S3_BUCKET:-youyidian3d};
|
|
echo 'MinIO bucket ready';
|
|
exit 0;
|
|
"
|
|
networks:
|
|
- app-network
|
|
|
|
app:
|
|
image: ${DOCKER_REGISTRY:-your-registry.com}/flnxi-material:standard-${IMAGE_TAG:-latest}
|
|
container_name: flnxi-material
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${APP_PORT:-4320}:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-youyidian123456}@postgres:5432/${POSTGRES_DB:-flnxi}
|
|
- DATABASE_DRIVER=node
|
|
- STORAGE_PROVIDER=s3
|
|
- S3_ENDPOINT=http://minio:9000
|
|
- S3_BUCKET=${S3_BUCKET:-youyidian3d}
|
|
- S3_ACCESS_KEY_ID=${MINIO_ROOT_USER:-minioadmin}
|
|
- S3_SECRET_ACCESS_KEY=${MINIO_ROOT_PASSWORD:-minioadmin123456}
|
|
- S3_REGION=us-east-1
|
|
- S3_PUBLIC_DOMAIN=http://${SERVER_IP:-localhost}:${MINIO_API_PORT:-9000}/${S3_BUCKET:-youyidian3d}
|
|
- S3_FILE_PATH=${S3_FILE_PATH:-materials/}
|
|
- S3_ENABLE_PATH_STYLE=1
|
|
- S3_SET_ACL=1
|
|
- S3_PREVIEW_URL_EXPIRE_IN=7200
|
|
- NEXT_PUBLIC_S3_FILE_PATH=${S3_FILE_PATH:-materials/}
|
|
- NEXTAUTH_URL=http://${SERVER_IP:-localhost}:${APP_PORT:-4320}
|
|
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-change-this-to-a-random-string-in-production}
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_healthy
|
|
minio-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- app-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
minio_data:
|
|
driver: local
|
|
|
|
networks:
|
|
app-network:
|
|
driver: bridge
|
|
|
|
|
|
|