version: '3.8' services: # FastAPI 后端 (SQLite 数据库,随项目文件存储) backend: build: context: ./backend dockerfile: Dockerfile container_name: ygdataset-backend ports: - "8000:8000" environment: - DATABASE_URL=sqlite:///./ygdataset.db - DEBUG=true volumes: - ./backend:/app - uploads:/app/uploads restart: unless-stopped # Vue 前端 frontend: build: context: ./frontend dockerfile: Dockerfile container_name: ygdataset-frontend ports: - "3000:80" volumes: - ./frontend:/app - /app/node_modules depends_on: - backend restart: unless-stopped volumes: uploads: # 如需 PostgreSQL,取消注释以下配置: # services: # postgres: # image: postgres:15 # environment: # POSTGRES_USER: ygdataset # POSTGRES_PASSWORD: your_password # POSTGRES_DB: ygdataset # ports: # - "5432:5432" # volumes: # - postgres_data:/var/lib/postgresql/data # volumes: # postgres_data: