iotkit-parent/docker-compose/docker-compose.yml

75 lines
2.2 KiB
YAML
Raw Normal View History

2023-10-15 01:20:44 +00:00
version: "3.4"
services:
2023-10-15 01:20:44 +00:00
mysql:
container_name: iot-mysql
image: mysql:8
restart: unless-stopped
tty: true
2022-07-14 08:38:11 +00:00
ports:
2023-10-15 01:20:44 +00:00
- "3306:3306"
environment:
2023-10-15 01:20:44 +00:00
MYSQL_DATABASE: ${MYSQL_DATABASE:-iotkit}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-123456}
2022-07-20 09:14:20 +00:00
volumes:
2023-10-15 01:20:44 +00:00
- mysql:/var/lib/mysql/
redis:
container_name: iot-redis
image: redis:6-alpine
restart: unless-stopped
ports:
2023-10-15 01:20:44 +00:00
- "6379:6379"
2022-07-20 09:14:20 +00:00
volumes:
2023-10-15 01:20:44 +00:00
- redis:/data
server:
container_name: iot-server
build:
context: ./
image: iot-server
restart: unless-stopped
ports:
2023-10-15 01:20:44 +00:00
- "8086:8086"
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://iot-mysql:3306/iotkit?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://iot-mysql:3306/iotkit?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:-iot-redis}
depends_on:
2022-07-20 09:14:20 +00:00
- redis
2023-10-15 01:20:44 +00:00
admin:
container_name: iot-admin
build:
context: ./iot-ui-admin
args:
NODE_ENV:
ENV=${NODE_ENV:-production}
PUBLIC_PATH=${PUBLIC_PATH:-/}
VUE_APP_TITLE=${VUE_APP_TITLE:-openiita管理系统}
image: iot-admin
restart: unless-stopped
ports:
- "8080:80"
depends_on:
- server
2022-07-20 09:14:20 +00:00
volumes:
2023-10-15 01:20:44 +00:00
mysql:
driver: local
redis:
driver: local