version: "3.9" services: backend: build: context: ./backend dockerfile: Dockerfile image: backup-system/backend:latest container_name: backup-backend env_file: - .env environment: # 容器内默认存储根目录 STORAGE_LOCAL_ROOT: /app/data/backups DATABASE_URL: sqlite:////app/data/backup.db volumes: - backend-data:/app/data - backend-logs:/app/logs # 默认 local storage 根;若自定义 local storage 路径,可再挂载 - local-backups:/app/data/backups ports: - "8765:8000" restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"] interval: 30s timeout: 5s retries: 5 start_period: 20s frontend: build: context: ./frontend dockerfile: Dockerfile image: backup-system/frontend:latest container_name: backup-frontend ports: - "5173:80" depends_on: backend: condition: service_healthy restart: unless-stopped volumes: backend-data: backend-logs: local-backups: