-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdocker-compose-basic.yml
More file actions
101 lines (94 loc) · 2.96 KB
/
docker-compose-basic.yml
File metadata and controls
101 lines (94 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# Copyright (c) 2013-Now https://jeesite.com All rights reserved.
# No deletion without permission, or be held responsible to law.
# @author ThinkGem
#
# 执行 docker-compose up 前,请先编译项目 mvn package
#
name: jeesite-cloud-basic
# ==================== Environment ====================
x-common-env: &common-env
TZ: Asia/Shanghai
LANG: C.UTF-8
MYSQL_HOST: jeesite-cloud-mysql
REDIS_HOST: jeesite-cloud-redis
NACOS_HOST: jeesite-cloud-nacos
# ==================== Service Base ====================
x-service-base: &service-base
#restart: unless-stopped
networks:
- jeesite-cloud-network
services:
# ==================== MySQL ====================
jeesite-cloud-mysql:
<<: *service-base
container_name: jeesite-cloud-mysql
image: docker.1ms.run/mysql:8.4
ports:
- "23306:3306"
environment:
<<: *common-env
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: 123456
volumes:
- ./.docker/mysql/log:/var/log/mysql
- ./.docker/mysql/data:/var/lib/mysql
- ./.docker/mysql/conf:/etc/mysql/conf.d
- ./nacos/db/mysql/create_user.sql:/docker-entrypoint-initdb.d/01-init.sql
- ./nacos/db/mysql/nacos.sql:/docker-entrypoint-initdb.d/02-nacos.sql
- ./modules/core/core/db/mysql/create_user.sql:/docker-entrypoint-initdb.d/03-core.sql
command: >
sh -c "ln -snf /usr/share/zoneinfo/$${TZ} /etc/localtime &&
echo $${TZ} > /etc/timezone && docker-entrypoint.sh mysqld"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p123456"]
interval: 5s
timeout: 5s
retries: 60
# ==================== Redis ====================
jeesite-cloud-redis:
<<: *service-base
container_name: jeesite-cloud-redis
image: docker.1ms.run/redis:7.2
ports:
- "26379:6379"
environment:
<<: *common-env
REDISCLI_AUTH: 1234
volumes:
- ./.docker/redis/data:/data
command: redis-server --requirepass 1234
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 60
# ==================== Nacos ====================
jeesite-cloud-nacos:
<<: *service-base
container_name: jeesite-cloud-nacos
image: docker.1ms.run/eclipse-temurin:17
ports:
- "8848:8848"
- "9848:9848"
- "8849:8849"
environment:
<<: *common-env
JAVA_OPTS: -Dspring.profiles.active=prod -Dnacos.home=/nacos
volumes:
- ./.docker/nacos:/nacos
- ./nacos/target:/app
working_dir: /app
command: >
sh -c "if [ ! -d 'web' ]; then mkdir web && cp web.war web && cd web && jar -xvf web.war &&
rm web.war && cd ..; fi && cd web/WEB-INF && exec sh startup.sh"
depends_on:
jeesite-cloud-mysql:
condition: service_healthy
jeesite-cloud-redis:
condition: service_healthy
# ==================== Networks ====================
networks:
jeesite-cloud-network:
name: jeesite-cloud-network
driver: bridge