Files
photography/backend/docker-compose.example.yml
xujiang 9c68a49080
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m25s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Failing after 47s
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m36s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Failing after 3s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
feat: 添加后端环境配置和 Docker Compose 示例文件
- 添加 backend/.env.example 环境变量模板
- 添加 backend/docker-compose.example.yml Docker 配置示例
- 更新 frontend/.env.local 配置注释
2025-07-14 15:29:10 +08:00

54 lines
1.6 KiB
YAML

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