Files
photography/backend/docker-compose.prod.yml
xujiang fdf524a172
Some checks failed
部署后端服务 / 🚀 构建并部署 (push) Has been cancelled
feat: 更新健康检查脚本和依赖
- 将健康检查命令从`/photography-api --health-check`更新为使用新的脚本`/usr/local/bin/health-check.sh`
- 在Dockerfile中添加`wget`作为运行时依赖
- 确保健康检查脚本具有执行权限

此更改提升了健康检查的可靠性和灵活性。
2025-07-16 15:02:27 +08:00

83 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Photography Portfolio Backend - Production Docker Compose
# 生产环境配置 - 使用现有 PostgreSQL 和 Redis 服务
# version 字段已废弃,不再需要使用
# version: '3.8'
services:
# 后端API服务 (仅API服务无数据库)
api:
image: crpi-b4fqtfbvv583enk2.cn-shanghai.personal.cr.aliyuncs.com/photography-backend/photography:latest
container_name: photography-api
environment:
# 数据库配置 (连接现有服务)
DB_HOST: ${DB_HOST:-redis_cache}
DB_PORT: ${DB_PORT:-5432}
DB_NAME: ${DB_NAME:-photography}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD}
DB_SSL_MODE: ${DB_SSL_MODE:-disable}
# 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}
JWT_EXPIRE: ${JWT_EXPIRE:-24h}
# 服务配置
APP_ENV: ${APP_ENV:-production}
APP_PORT: ${APP_PORT:-8080}
APP_HOST: ${APP_HOST:-0.0.0.0}
# CORS配置
CORS_ORIGINS: ${CORS_ORIGINS:-https://photography.iriver.top}
# 文件上传配置
UPLOAD_PATH: ${UPLOAD_PATH:-/app/uploads}
UPLOAD_MAX_SIZE: ${UPLOAD_MAX_SIZE:-10485760}
# 日志配置
LOG_LEVEL: ${LOG_LEVEL:-info}
LOG_FORMAT: ${LOG_FORMAT:-json}
ports:
- "8080:8080"
networks:
- app_network
volumes:
- uploads_data:/app/uploads
- logs_data:/app/logs
restart: unless-stopped
healthcheck:
test: ["CMD", "/usr/local/bin/health-check.sh"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# 数据库迁移服务 (一次性运行)
migrate:
image: crpi-b4fqtfbvv583enk2.cn-shanghai.personal.cr.aliyuncs.com/photography-backend/photography:latest
container_name: photography-migrate
environment:
DB_HOST: ${DB_HOST:-localhost}
DB_PORT: ${DB_PORT:-5432}
DB_NAME: ${DB_NAME:-photography}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD}
DB_SSL_MODE: ${DB_SSL_MODE:-disable}
entrypoint: ["/migrate", "up"]
restart: "no"
volumes:
uploads_data:
driver: local
logs_data:
driver: local
networks:
app_network:
external: true