Files
Aether/docker-compose.build.yml

79 lines
2.1 KiB
YAML
Raw Permalink Normal View History

# Aether 部署配置 - 本地构建
# 使用方法:
# 首次构建 base: docker build -f Dockerfile.base -t aether-base:latest .
# 启动服务: docker-compose -f docker-compose.build.yml up -d --build
services:
postgres:
image: postgres:15
container_name: aether-postgres
environment:
POSTGRES_DB: aether
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD}
TZ: Asia/Shanghai
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
container_name: aether-redis
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
app:
build:
context: .
dockerfile: Dockerfile.app.local
image: aether-app:latest
container_name: aether-app
environment:
DATABASE_URL: postgresql://postgres:${DB_PASSWORD}@postgres:5432/aether
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
PORT: 8084
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
JWT_ALGORITHM: HS256
JWT_EXPIRATION_DELTA: 86400
LOG_LEVEL: ${LOG_LEVEL:-INFO}
ADMIN_EMAIL: ${ADMIN_EMAIL}
ADMIN_USERNAME: ${ADMIN_USERNAME}
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
API_KEY_PREFIX: ${API_KEY_PREFIX:-sk}
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-4}
TZ: Asia/Shanghai
PYTHONIOENCODING: utf-8
LANG: C.UTF-8
LC_ALL: C.UTF-8
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "${APP_PORT:-8084}:80"
volumes:
- ./logs:/app/logs
restart: unless-stopped
volumes:
postgres_data:
redis_data: