Files
label_backend/docker-compose.yml

97 lines
2.6 KiB
YAML
Raw Permalink Normal View History

version: "3.9"
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: label_db
POSTGRES_USER: label
POSTGRES_PASSWORD: label_password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
2026-04-14 18:36:28 +08:00
- ./src/main/resources/sql/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U label -d label_db"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
command: redis-server --requirepass redis_password
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis_password", "ping"]
interval: 10s
timeout: 5s
retries: 5
# RustFS is an S3-compatible object storage service.
# Using MinIO as a drop-in S3 API substitute for development/testing.
# Replace with the actual RustFS image in production environments.
rustfs:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000"
- "9001:9001"
volumes:
- rustfs_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
backend:
build: .
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/label_db
SPRING_DATASOURCE_USERNAME: label
SPRING_DATASOURCE_PASSWORD: label_password
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
SPRING_DATA_REDIS_PASSWORD: redis_password
RUSTFS_ENDPOINT: http://rustfs:9000
RUSTFS_ACCESS_KEY: minioadmin
RUSTFS_SECRET_KEY: minioadmin
AI_SERVICE_BASE_URL: http://ai-service:8000
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rustfs:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:8080/actuator/health 2>/dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Placeholder AI service — replace with the actual FastAPI image in production.
ai-service:
image: python:3.11-slim
command: ["python3", "-m", "http.server", "8000"]
ports:
- "8000:8000"
# Placeholder frontend — replace with the actual Nginx + static build in production.
frontend:
image: nginx:alpine
ports:
- "80:80"
volumes:
postgres_data:
rustfs_data: