51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
fileshare:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.multi # 使用多阶段构建优化镜像
|
|
args:
|
|
- PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
|
- PIP_TRUSTED_HOST=mirrors.aliyun.com
|
|
image: fileshare:latest
|
|
container_name: fileshare-service
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${PORT:-8000}:8000"
|
|
environment:
|
|
- HOST=0.0.0.0
|
|
- PORT=8000
|
|
- MAX_FILE_SIZE=${MAX_FILE_SIZE:-104857600} # 100MB
|
|
- EXPIRE_MINUTES=${EXPIRE_MINUTES:-15}
|
|
volumes:
|
|
# 持久化上传目录(可选,重启后文件会保留)
|
|
- ./data/uploads:/app/uploads
|
|
# 日志目录(可选)
|
|
- ./data/logs:/app/logs
|
|
networks:
|
|
- fileshare-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
|
|
|
|
networks:
|
|
fileshare-network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16
|
|
|