2
0

feat: enhance build and setup

This commit is contained in:
zhangsz
2024-12-30 10:12:54 +08:00
parent c43c799ae0
commit 25f17f91bb
22 changed files with 372 additions and 201 deletions

View File

@@ -1,219 +1,297 @@
services:
wfc-nacos:
container_name: wfc-nacos
image: nacos/nacos-server
container_name: wfc-nacos
build:
context: ./nacos
environment:
- MODE=standalone
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
volumes:
- ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
ports:
- "8848:8848"
- "9848:9848"
- "9849:9849"
- "${NACOS_SERVER_PORT}:${NACOS_SERVER_PORT}"
networks:
- wfc-fe-network
- wfc-be-network
depends_on:
- wfc-mysql
restart: ${RESTART_OPTION}
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: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-mysql:
container_name: wfc-mysql
image: mysql:5.7
container_name: wfc-mysql
build:
context: ./mysql
ports:
- "3306:3306"
- "${MYSQL_PORT}:${MYSQL_PORT}"
networks:
- wfc-be-network
- wfc-fe-network
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d
- ./mysql/conf.d:/etc/mysql/conf.d
- ./mysql/logs:/logs
- ./mysql/logs:/opt/wfc/mysql/logs
- ./mysql/data:/var/lib/mysql
- ./mysql/tmp:/tmp
# command: [
# 'mysqld',
# '--defaults-extra-file=/etc/mysql/conf.d/my.cnf',
# '--innodb-buffer-pool-size=80M',
# '--character-set-server=utf8mb4',
# '--collation-server=utf8mb4_unicode_ci',
# '--default-time-zone=+8:00',
# '--lower-case-table-names=1'
# ]
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
restart: ${RESTART_OPTION}
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-redis:
image: redis
container_name: wfc-redis
image: redis
build:
context: ./redis
ports:
- "6379:6379"
- "${REDIS_PORT}:${REDIS_PORT}"
networks:
- wfc-be-network
volumes:
- ./redis/conf/redis.conf:/home/wfc/redis/redis.conf
- ./redis/data:/data
command: redis-server /home/wfc/redis/redis.conf
restart: ${RESTART_OPTION}
- ./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", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-gateway:
image: wfc-java:jre8
container_name: wfc-gateway
build:
context: ./wfc/gateway
dockerfile: dockerfile
# build:
# context: ./wfc/gateway
# dockerfile: dockerfile
ports:
- "8080:8080"
networks:
- wfc-be-network
- wfc-fe-network
volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar
depends_on:
- wfc-redis
links:
- wfc-redis
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
wfc-auth:
container_name: wfc-auth
build:
context: ./wfc/auth
dockerfile: dockerfile
ports:
- "9200:9200"
- "${GATEWAY_SERVER_PORT}:${GATEWAY_SERVER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar
- ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/app.jar
depends_on:
- wfc-redis
links:
- wfc-redis
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
wfc-redis:
condition: service_healthy
wfc-nacos:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-nacos
environment:
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- GATEWAY_SERVER_IP=${GATEWAY_SERVER_IP}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT}/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-auth:
image: wfc-java:jre8
container_name: wfc-auth
# build:
# context: ./wfc/auth
# dockerfile: dockerfile
ports:
- "${AUTH_SERVER_PORT}:${AUTH_SERVER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/opt/wfc/app.jar
depends_on:
wfc-redis:
condition: service_healthy
wfc-nacos:
condition: service_healthy
# links:
# - wfc-redis
environment:
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- AUTH_SERVER_IP=${AUTH_SERVER_IP}
- AUTH_SERVER_PORT=${AUTH_SERVER_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://${AUTH_SERVER_IP}:${AUTH_SERVER_PORT}/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-modules-system:
image: wfc-java:jre8
container_name: wfc-modules-system
build:
context: ./wfc/modules/system
dockerfile: dockerfile
# build:
# context: ./wfc/modules/system
# dockerfile: dockerfile
ports:
- "9201:9201"
- "${WFC_SYSTEM_PORT}:${WFC_SYSTEM_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/system/jar/wfc-modules-system.jar:/home/wfc/wfc-modules-system.jar
- ./wfc/modules/system/jar/wfc-modules-system.jar:/opt/wfc/app.jar
depends_on:
- wfc-redis
- wfc-mysql
links:
- wfc-redis
- wfc-mysql
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_SYSTEM_PORT=${WFC_SYSTEM_PORT}
restart: ${RESTART_OPTION}
wfc-modules-user:
image: wfc-java:jre8
container_name: wfc-modules-user
build:
context: ./wfc/modules/user
dockerfile: dockerfile
# build:
# context: ./wfc/modules/user
# dockerfile: dockerfile
ports:
- "9204:9204"
- "${WFC_USER_PORT}:${WFC_USER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/user/jar/wfc-modules-user.jar:/home/wfc/wfc-modules-user.jar
- ./wfc/modules/user/jar/wfc-modules-user.jar:/opt/wfc/app.jar
depends_on:
- wfc-redis
- wfc-mysql
links:
- wfc-redis
- wfc-mysql
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_USER_PORT=${WFC_USER_PORT}
restart: ${RESTART_OPTION}
wfc-modules-job:
image: wfc-java:jre8
container_name: wfc-modules-job
build:
context: ./wfc/modules/job
dockerfile: dockerfile
# build:
# context: ./wfc/modules/job
# dockerfile: dockerfile
ports:
- "9203:9203"
- "${WFC_JOB_PORT}:${WFC_JOB_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/job/jar/wfc-modules-job.jar:/home/wfc/wfc-modules-job.jar
- ./wfc/modules/job/jar/wfc-modules-job.jar:/opt/wfc/app.jar
depends_on:
- wfc-mysql
links:
- wfc-mysql
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_JOB_PORT=${WFC_JOB_PORT}
restart: ${RESTART_OPTION}
wfc-modules-payment:
image: wfc-java:jre8
container_name: wfc-modules-payment
build:
context: ./wfc/modules/payment
dockerfile: dockerfile
# build:
# context: ./wfc/modules/payment
# dockerfile: dockerfile
ports:
- "9306:9306"
- "${WFC_PAYMENT_PORT}:${WFC_PAYMENT_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar
# - ./wfc/modules/payment/logs/:/home/wfc/logs/
- ./wfc/modules/payment/config/:/home/wfc/config/payment/
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/opt/wfc/app.jar
# - ./wfc/modules/payment/logs/:/opt/wfc/logs/
- ./wfc/modules/payment/config/:/opt/wfc/config/payment/
depends_on:
- wfc-redis
- wfc-mysql
links:
- wfc-redis
- wfc-mysql
wfc-redis:
condition: service_healthy
wfc-mysql:
condition: service_healthy
wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_PAYMENT_PORT=${WFC_PAYMENT_PORT}
restart: ${RESTART_OPTION}
wfc-nginx:
image: nginx
container_name: wfc-nginx
image: nginx
build:
context: ./nginx
ports:
- "80:80"
- "${WFC_SERVER_PORT}:${WFC_SERVER_PORT}"
networks:
- wfc-fe-network
- wfc-be-network
volumes:
- ./nginx/html/dist:/home/wfc/portal
- ./nginx/html/dist:/opt/wfc/portal
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on:
- wfc-gateway
links:
- wfc-gateway
wfc-gateway:
condition: service_healthy
# links:
# - wfc-gateway
environment:
- GATEWAY_ADDR=${GATEWAY_ADDR}
- GATEWAY_SERVER_IP=${GATEWAY_SERVER_IP}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
- WFC_SERVER_IP=${WFC_SERVER_IP}
- WFC_SERVER_PORT=${WFC_SERVER_PORT}
restart: ${RESTART_OPTION}
networks:
wfc-fe-network:
name: wfc-fe-network
driver: bridge
wfc-be-network:
name: wfc-be-network
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16
driver: default