Files
EasyFlow/docker-compose.yml
2026-02-22 18:56:10 +08:00

81 lines
2.2 KiB
YAML

services:
# 后端服务
easyflow-api:
build:
context: .
dockerfile: 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
- SPRING_REDIS_HOST=redis
- SPRING_REDIS_PASSWORD=${REDIS_PASSWORD:-easyflow_redis_2026}
- SPRING_WEB_RESOURCES_STATIC_LOCATIONS=file:/www/easyflow/attachment/
- 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