version: '3.8' services: backend: image: registry.cn-hangzhou.aliyuncs.com/photography/backend:latest container_name: photography_backend restart: unless-stopped network_mode: host # 使用主机网络连接现有的PostgreSQL和Redis environment: # 数据库配置 (连接现有的PostgreSQL) DB_HOST: ${DB_HOST:-localhost} DB_PORT: ${DB_PORT:-5432} DB_NAME: ${DB_NAME:-photography} DB_USER: ${DB_USER:-postgres} DB_PASSWORD: ${DB_PASSWORD:-your_password} DB_SSLMODE: ${DB_SSLMODE:-disable} # Redis配置 (连接现有的Redis) REDIS_HOST: ${REDIS_HOST:-localhost} REDIS_PORT: ${REDIS_PORT:-6379} REDIS_PASSWORD: ${REDIS_PASSWORD:-} REDIS_DB: ${REDIS_DB:-0} # JWT配置 JWT_SECRET: ${JWT_SECRET:-your_jwt_secret_key} JWT_EXPIRE: ${JWT_EXPIRE:-24h} # 服务配置 APP_ENV: ${APP_ENV:-production} APP_PORT: ${APP_PORT:-8080} APP_HOST: ${APP_HOST:-0.0.0.0} # 文件上传配置 UPLOAD_DIR: ${UPLOAD_DIR:-/app/uploads} MAX_FILE_SIZE: ${MAX_FILE_SIZE:-10485760} # 10MB # CORS配置 CORS_ORIGINS: ${CORS_ORIGINS:-https://photography.iriver.top,https://admin.photography.iriver.top} # 日志配置 LOG_LEVEL: ${LOG_LEVEL:-info} volumes: # 文件上传存储 - /home/gitea/photography/uploads:/app/uploads # 日志存储 - /home/gitea/photography/logs:/app/logs healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s