From 8e64e93d9e8e45f36ca4c60a604587abb25dcf33 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Tue, 25 Apr 2023 22:54:56 +0800 Subject: [PATCH] feat: docker-compose docker.env --- docker-compose.yml | 86 ++++++++++++++++++++++++++++++++++++++++++++++ docker.env | 25 ++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker.env diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..9f59770dc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,86 @@ +version: "3.8" + +services: + mysql: + container_name: yudao-mysql + image: mysql:8 + restart: unless-stopped + tty: true + ports: + - 3308:3306 + environment: + MYSQL_DATABASE: ${MYSQL_DATABASE:-ruoyi-vue-pro} + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-123456} + volumes: + - mysql:/var/lib/mysql/ + networks: + - yudao-network + + redis: + container_name: yudao-redis + image: redis:6-alpine + ports: + - 6379:6379 + networks: + - yudao-network + + server: + container_name: yudao-server + build: + context: ./yudao-server/ + image: yudao-server + ports: + - 48080:48080 + environment: + # https://github.com/polovyivan/docker-pass-configs-to-container + SPRING_PROFILES_ACTIVE: local + JAVA_OPTS: + ${JAVA_OPTS:- + -Xms512m + -Xmx512m + -Djava.security.egd=file:/dev/./urandom + } + ARGS: + --spring.datasource.dynamic.datasource.master.url=${MASTER_DATASOURCE_URL:-jdbc:mysql://yudao-mysql:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true} + --spring.datasource.dynamic.datasource.master.username=${MASTER_DATASOURCE_USERNAME:-root} + --spring.datasource.dynamic.datasource.master.password=${MASTER_DATASOURCE_PASSWORD:-123456} + --spring.datasource.dynamic.datasource.slave.url=${SLAVE_DATASOURCE_URL:-jdbc:mysql://yudao-mysql:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true} + --spring.datasource.dynamic.datasource.slave.username=${SLAVE_DATASOURCE_USERNAME:-root} + --spring.datasource.dynamic.datasource.slave.password=${SLAVE_DATASOURCE_PASSWORD:-123456} + --spring.redis.host=${REDIS_HOST:-yudao-redis} + networks: + - yudao-network + depends_on: + - mysql + - redis + + admin: + container_name: yudao-admin + build: + context: ./yudao-ui-admin + args: + NODE_ENV: + ENV=${NODE_ENV:-production} + PUBLIC_PATH=${PUBLIC_PATH:-/} + VUE_APP_TITLE=${VUE_APP_TITLE:-芋道管理系统} + VUE_APP_BASE_API=${VUE_APP_BASE_API:-/prod-api} + VUE_APP_APP_NAME=${VUE_APP_APP_NAME:-/} + VUE_APP_TENANT_ENABLE=${VUE_APP_TENANT_ENABLE:-true} + VUE_APP_CAPTCHA_ENABLE=${VUE_APP_CAPTCHA_ENABLE:-true} + VUE_APP_DOC_ENABLE=${VUE_APP_DOC_ENABLE:-true} + VUE_APP_BAIDU_CODE=${VUE_APP_BAIDU_CODE:-fadc1bd5db1a1d6f581df60a1807f8ab} + image: yudao-admin + ports: + - 8080:80 + networks: + - yudao-network + depends_on: + - server + +networks: + yudao-network: + driver: bridge + +volumes: + mysql: + driver: local diff --git a/docker.env b/docker.env new file mode 100644 index 000000000..0bf6e997e --- /dev/null +++ b/docker.env @@ -0,0 +1,25 @@ +## mysql +MYSQL_DATABASE=ruoyi-vue-pro +MYSQL_ROOT_PASSWORD=123456 + +## server +JAVA_OPTS=-Xms512m -Xmx512m -Djava.security.egd=file:/dev/./urandom + +MASTER_DATASOURCE_URL=jdbc:mysql://yudao-mysql:3306/${MYSQL_DATABASE}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +MASTER_DATASOURCE_USERNAME=root +MASTER_DATASOURCE_PASSWORD=${MYSQL_ROOT_PASSWORD} +SLAVE_DATASOURCE_URL=${MASTER_DATASOURCE_URL} +SLAVE_DATASOURCE_USERNAME=${MASTER_DATASOURCE_USERNAME} +SLAVE_DATASOURCE_PASSWORD=${MASTER_DATASOURCE_PASSWORD} +REDIS_HOST=yudao-redis + +## admin +NODE_ENV=production +PUBLIC_PATH=/ +VUE_APP_TITLE=芋道管理系统 +VUE_APP_BASE_API=/prod-api +VUE_APP_APP_NAME=/ +VUE_APP_TENANT_ENABLE=true +VUE_APP_CAPTCHA_ENABLE=true +VUE_APP_DOC_ENABLE=true +VUE_APP_BAIDU_CODE=fadc1bd5db1a1d6f581df60a1807f8ab