2
0
Files
build.wfc/build/docker/compose/docker-compose.yml
2025-04-16 16:15:41 +08:00

394 lines
14 KiB
YAML

services:
wfc-mysql:
image: mysql:5.7
container_name: ${MYSQL_SERVICE_NAME}
build:
context: ./mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- TZ=${TZ}
ports:
- "${MYSQL_SERVICE_PORT}:${MYSQL_SERVICE_PORT}"
networks:
- wfc-be-network
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d
- ./mysql/conf.d:/etc/mysql/conf.d
- ./mysql/logs:/opt/wfc/mysql/logs
- ./mysql/data:/var/lib/mysql
- ./mysql/tmp:/tmp
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -u root -p'${MYSQL_ROOT_PASSWORD}'"]
interval: 10s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-redis:
image: redis:7.4.2
container_name: wfc-redis
build:
context: ./redis
environment:
- TZ=${TZ}
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
networks:
- wfc-be-network
volumes:
- ./redis/conf/redis.conf:/opt/wfc/redis/redis.conf
- ./redis/data:/opt/wfc/redis/data
command: redis-server /opt/wfc/redis/redis.conf
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-nacos:
image: nacos/nacos-server:v2.5.0
container_name: ${NACOS_SERVER_NAME}
build:
context: ./nacos
environment:
- MODE=standalone
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_SERVICE_HOST=${MYSQL_SERVICE_NAME}
- MYSQL_SERVICE_DB_NAME=${WFC_CONFIG_DATABASE}
- MYSQL_SERVICE_PORT=${MYSQL_SERVICE_PORT}
- MYSQL_SERVICE_USER=${MYSQL_SERVICE_USER}
- MYSQL_SERVICE_PASSWORD=${MYSQL_SERVICE_PASSWORD}
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/home/nacos/conf/
- TZ=${TZ}
volumes:
- ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
ports:
- "${NACOS_SERVER_PORT}:${NACOS_SERVER_PORT}"
networks:
- wfc-be-network
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://${NACOS_SERVER_IP}:${NACOS_SERVER_PORT}/nacos/v1/console/health/liveness || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-gateway:
image: wfc-java:jre8
container_name: wfc-gateway
ports:
- "${GATEWAY_SERVER_PORT}:${GATEWAY_SERVER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/app.jar
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/gateway/conf/application.yml:/opt/wfc/conf/application.yml
- ./conf/license:/opt/wfc/license
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-nacos:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${GATEWAY_SERVER_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 10
restart: ${RESTART_OPTION}
wfc-auth:
image: wfc-java:jre8
container_name: wfc-auth
ports:
- "${AUTH_SERVER_PORT}:${AUTH_SERVER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/opt/wfc/app.jar
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/auth/conf/application.yml:/opt/wfc/conf/application.yml
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-nacos:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- AUTH_SERVER_PORT=${AUTH_SERVER_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${AUTH_SERVER_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 10
restart: ${RESTART_OPTION}
wfc-modules-system:
image: wfc-java:jre8
container_name: wfc-modules-system
ports:
- "${WFC_SYSTEM_PORT}:${WFC_SYSTEM_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/system/jar/wfc-modules-system.jar:/opt/wfc/app.jar
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/modules/system/conf/application.yml:/opt/wfc/conf/application.yml
- ./conf/templates/system:/opt/wfc/templates
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_SYSTEM_PORT=${WFC_SYSTEM_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_SYSTEM_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 6
restart: ${RESTART_OPTION}
wfc-modules-user:
image: wfc-java:jre8
container_name: wfc-modules-user
ports:
- "${WFC_USER_PORT}:${WFC_USER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/user/jar/wfc-modules-user.jar:/opt/wfc/app.jar
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/modules/user/conf/application.yml:/opt/wfc/conf/application.yml
- ./conf/templates/user:/opt/wfc/templates
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_USER_PORT=${WFC_USER_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_USER_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 6
restart: ${RESTART_OPTION}
wfc-modules-file:
image: wfc-java:jre8
container_name: wfc-modules-file
ports:
- "${WFC_FILE_PORT}:${WFC_FILE_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/file/jar/wfc-modules-file.jar:/opt/wfc/app.jar
- ./wfc/modules/file/upload:/opt/wfc/upload
- ./wfc/modules/file/logs/:/opt/wfc/logs/
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/modules/file/conf/application.yml:/opt/wfc/conf/application.yml
depends_on:
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_FILE_PORT=${WFC_FILE_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_FILE_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 6
restart: ${RESTART_OPTION}
wfc-modules-job:
image: wfc-java:jre8
container_name: wfc-modules-job
ports:
- "${WFC_JOB_PORT}:${WFC_JOB_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/job/jar/wfc-modules-job.jar:/opt/wfc/app.jar
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/modules/job/conf/application.yml:/opt/wfc/conf/application.yml
depends_on:
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_JOB_PORT=${WFC_JOB_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_JOB_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 6
restart: ${RESTART_OPTION}
wfc-modules-payment:
image: wfc-java:jre8
container_name: wfc-modules-payment
ports:
- "${WFC_PAYMENT_PORT}:${WFC_PAYMENT_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/opt/wfc/app.jar
- ./wfc/modules/payment/logs/:/opt/wfc/logs/
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
- ./conf/i18n/:/opt/wfc/conf/i18n
- ./wfc/modules/payment/conf/application.yml:/opt/wfc/conf/application.yml
depends_on:
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
environment:
- NACOS_PROFILE_NAME=${NACOS_PROFILE_NAME}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_NAME=${NACOS_SERVER_NAME}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_PAYMENT_PORT=${WFC_PAYMENT_PORT}
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:classpath:/,optional:file:/opt/wfc/conf/
- TZ=${TZ}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WFC_PAYMENT_PORT}/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 6
restart: ${RESTART_OPTION}
wfc-nginx:
image: nginx:1.27.4
container_name: wfc-nginx
build:
context: ./nginx
ports:
- "${WFC_SERVER_PORT}:${WFC_SERVER_PORT}"
- "${WFC_SERVER_HTTPS_PORT}:${WFC_SERVER_HTTPS_PORT}"
networks:
- wfc-fe-network
- wfc-be-network
volumes:
- ./wfc/modules/file/upload:/opt/wfc/file/upload
- ./nginx/html/dist:/opt/wfc/portal
- ./nginx/ssl:/opt/wfc/ssl
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on:
wfc-modules-system:
condition: service_healthy
wfc-modules-user:
condition: service_healthy
environment:
- GATEWAY_SERVER_IP=${GATEWAY_SERVER_IP}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
- WFC_SERVER_IP=${WFC_SERVER_IP}
- WFC_SERVER_PORT=${WFC_SERVER_PORT}
- TZ=${TZ}
healthcheck:
test:
- "CMD-SHELL"
- >
curl -f http://localhost:${WFC_SERVER_PORT}/sys &&
curl -f http://localhost:${WFC_SERVER_PORT}/u ||
exit 1
interval: 30s
timeout: 5s
retries: 6
restart: ${RESTART_OPTION}
networks:
wfc-fe-network:
name: wfc-fe-network
driver: bridge
wfc-be-network:
name: wfc-be-network
driver: bridge
ipam:
driver: default