services: # 后端服务 easyflow-api: build: context: .. dockerfile: easyflow/Dockerfile ports: - "8080:8080" environment: - SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/easyflow?useInformationSchema=true&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai - SPRING_DATASOURCE_USERNAME=root - SPRING_DATASOURCE_PASSWORD=123456 - SERVER_PORT=8080 - SPRING_DATA_REDIS_HOST=redis - SPRING_DATA_REDIS_PORT=6379 - SPRING_DATA_REDIS_PASSWORD=${REDIS_PASSWORD:-easyflow_redis_2026} - SPRING_DATA_REDIS_DATABASE=0 - SPRING_WEB_RESOURCES_STATIC_LOCATIONS=file:/www/easyflow/attachment/ - EASYFLOW_STORAGE_TYPE=local - EASYFLOW_STORAGE_LOCAL_ROOT=/www/easyflow/attachment networks: - easyflow-net volumes: - ./attachment:/www/easyflow/attachment depends_on: mysql: condition: service_healthy redis: condition: service_started # 管理后台前端 easyflow-ui-admin: build: context: ./easyflow-ui-admin dockerfile: scripts/deploy/Dockerfile ports: - "8081:8080" networks: - easyflow-net depends_on: - easyflow-api # 用户中心前端 easyflow-ui-usercenter: build: context: ./easyflow-ui-usercenter dockerfile: scripts/deploy/Dockerfile ports: - "8082:8080" networks: - easyflow-net depends_on: - easyflow-api # 数据库 mysql: image: mysql:8.0 command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --lower-case-table-names=1 environment: MYSQL_ROOT_PASSWORD: 123456 MYSQL_DATABASE: easyflow ports: - "3306:3306" volumes: - ./sql:/docker-entrypoint-initdb.d # 这个命令在默认 entrypoint 运行前修复权限 entrypoint: sh -c "chown -R mysql:mysql /docker-entrypoint-initdb.d && docker-entrypoint.sh mysqld" networks: - easyflow-net healthcheck: test: ["CMD", "mysqladmin", "ping", "-u", "root", "-p$MYSQL_ROOT_PASSWORD", "-h", "localhost"] timeout: 5s retries: 5 # Redis (后端可能需要) redis: image: redis:alpine command: redis-server --requirepass ${REDIS_PASSWORD:-easyflow_redis_2026} networks: - easyflow-net networks: easyflow-net: driver: bridge