Set up project files and add .gitignore to exclude local build/runtime artifacts. Made-with: Cursor
79 lines
1.8 KiB
YAML
79 lines
1.8 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
# 开发环境使用 SQLite 和 miniredis,不需要外部数据库服务
|
||
# 如需使用 PostgreSQL 和 Redis,切换 config.yaml 中的配置并取消注释以下服务
|
||
|
||
# PostgreSQL (生产环境使用)
|
||
# postgres:
|
||
# image: postgres:15-alpine
|
||
# container_name: carrot_bbs_postgres
|
||
# environment:
|
||
# POSTGRES_USER: postgres
|
||
# POSTGRES_PASSWORD: postgres
|
||
# POSTGRES_DB: carrot_bbs
|
||
# ports:
|
||
# - "5432:5432"
|
||
# volumes:
|
||
# - postgres_data:/var/lib/postgresql/data
|
||
# healthcheck:
|
||
# test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||
# interval: 10s
|
||
# timeout: 5s
|
||
# retries: 5
|
||
|
||
# Redis (生产环境使用)
|
||
# redis:
|
||
# image: redis:7-alpine
|
||
# container_name: carrot_bbs_redis
|
||
# ports:
|
||
# - "6379:6379"
|
||
# volumes:
|
||
# - redis_data:/data
|
||
# healthcheck:
|
||
# test: ["CMD", "redis-cli", "ping"]
|
||
# interval: 10s
|
||
# timeout: 5s
|
||
# retries: 5
|
||
|
||
# MinIO (对象存储,可选)
|
||
minio:
|
||
image: minio/minio:latest
|
||
container_name: carrot_bbs_minio
|
||
environment:
|
||
MINIO_ROOT_USER: minioadmin
|
||
MINIO_ROOT_PASSWORD: minioadmin
|
||
ports:
|
||
- "9000:9000"
|
||
- "9001:9001"
|
||
volumes:
|
||
- minio_data:/data
|
||
command: server /data --console-address ":9001"
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||
interval: 30s
|
||
timeout: 20s
|
||
retries: 3
|
||
|
||
app:
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile
|
||
container_name: carrot_bbs_app
|
||
ports:
|
||
- "8080:8080"
|
||
depends_on:
|
||
minio:
|
||
condition: service_healthy
|
||
environment:
|
||
- CONFIG_PATH=/app/configs/config.yaml
|
||
volumes:
|
||
- ./configs:/app/configs
|
||
- ./logs:/app/logs
|
||
- ./data:/app/data
|
||
|
||
volumes:
|
||
# postgres_data:
|
||
# redis_data:
|
||
minio_data:
|