version: '3.8' services: # Making 前端应用 making-app: build: context: . dockerfile: Dockerfile # 如果需要传递构建参数 # args: # - NODE_ENV=production container_name: making-app # 端口映射 ports: - "3000:80" # 环境变量 environment: - NODE_ENV=production # 重启策略 restart: unless-stopped # 健康检查 healthcheck: test: ["CMD", "curl", "-f", "http://localhost/"] interval: 30s timeout: 3s retries: 3 start_period: 5s # 资源限制 deploy: resources: limits: cpus: '1.0' memory: 512M reservations: cpus: '0.5' memory: 256M # 网络 networks: - making-network # 日志配置 logging: driver: "json-file" options: max-size: "10m" max-file: "3" # 网络配置 networks: making-network: driver: bridge # 卷配置(如果需要持久化数据) # volumes: # making-data: # driver: local