-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
160 lines (153 loc) · 5.19 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
160 lines (153 loc) · 5.19 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# ecshopx 全量开发编排:MySQL + Redis + XXL-Job + 一体化 app(Java + Nginx + Nuxt)
#
# 使用:
# cd ECShopX-Java
# docker compose -f docker-compose.dev.yml up -d
# docker compose -f docker-compose.dev.yml logs -f ecshopx-app
#
# 端口映射:
# - 80 Nginx HTTP(HTTP_HOST_PORT);按 Host 路由 admin / h5 / pc(ADMIN_HOST / H5_HOST / PC_HOST)
# - 8080 XXL-Job Admin(XXL_HOST_PORT)
# - 18080 ecshopx-app Java HTTP API(直连调试)
# - 19999 XXL-Job Executor
# - 3306 MySQL(MYSQL_HOST_PORT,可覆盖)
# - 6379 Redis(REDIS_HOST_PORT,可覆盖)
name: ecshopx-dev
services:
mysql:
image: mysql:8.0
container_name: ecshopx-dev-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: ecshopx
MYSQL_USER: ecshopx
MYSQL_PASSWORD: ecshopx
TZ: Asia/Shanghai
ports:
- "${MYSQL_HOST_PORT:-3306}:3306"
volumes:
- mysql-data:/var/lib/mysql
- ./docker/tables_xxl_job.sql:/docker-entrypoint-initdb.d/00-tables_xxl_job.sql:ro
- ./docker/ecshopx.sql:/docker-entrypoint-initdb.d/10-ecshopx.sql:ro
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
- --max-allowed-packet=64M
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-prootpassword"]
interval: 5s
timeout: 5s
retries: 60
start_period: 30s
networks: [ecshopx-dev]
redis:
image: redis:7-alpine
container_name: ecshopx-dev-redis
restart: unless-stopped
command:
- redis-server
- --requirepass
- redispassword
- --appendonly
- "yes"
- --tcp-keepalive
- "60"
ports:
- "${REDIS_HOST_PORT:-6379}:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "redispassword", "PING"]
interval: 5s
timeout: 3s
retries: 20
networks: [ecshopx-dev]
xxl-job-admin:
image: xuxueli/xxl-job-admin:2.5.0
container_name: ecshopx-dev-xxl-job-admin
restart: unless-stopped
platform: linux/amd64
depends_on:
mysql:
condition: service_healthy
ports:
- "${XXL_HOST_PORT:-8080}:8080"
environment:
PARAMS: >-
--server.servlet.context-path=/xxl-job-admin
--spring.datasource.url=jdbc:mysql://mysql:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
--spring.datasource.username=root
--spring.datasource.password=rootpassword
--xxl.job.accessToken=ecshopx-cron-dev
healthcheck:
test: ["CMD-SHELL", "bash -c ': </dev/tcp/127.0.0.1/8080' >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 60
start_period: 90s
networks: [ecshopx-dev]
ecshopx-app:
build:
context: .
dockerfile: docker/Dockerfile.app
pull: false
args:
MAVEN_BUILD_IMAGE: ${MAVEN_BUILD_IMAGE:-maven:3.9-eclipse-temurin-17}
RUNTIME_BASE_IMAGE: ${RUNTIME_BASE_IMAGE:-ecshopx-java:17-node20-openresty}
image: ecshopx-app:latest
container_name: ecshopx-dev-app
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
xxl-job-admin:
condition: service_healthy
ports:
- "${HTTP_HOST_PORT:-80}:80"
- "18080:18080"
- "19999:19999"
environment:
TZ: Asia/Shanghai
JAVA_OPTS: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -Djava.security.egd=file:/dev/./urandom"
JWT_SECRET: ${JWT_SECRET}
ADMIN_HOST: ${ADMIN_HOST:-admin.ecshopx.test}
H5_HOST: ${H5_HOST:-h5.ecshopx.test}
PC_HOST: ${PC_HOST:-www.ecshopx.test}
NUXT_PUBLIC_API_BASE: ${NUXT_PUBLIC_API_BASE:-http://admin.ecshopx.test/api/v1/h5app}
NUXT_PUBLIC_DECORATION_ADMIN_ORIGINS: ${NUXT_PUBLIC_DECORATION_ADMIN_ORIGINS:-http://admin.ecshopx.test}
NUXT_API_BASE_INTERNAL: http://127.0.0.1:18080/api/v1/h5app
NUXT_API_BASE: http://127.0.0.1:18080/api/v1/h5app
APP_ARGS: >-
--server.port=18080
--spring.datasource.url=jdbc:mysql://mysql:3306/ecshopx?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
--spring.datasource.username=ecshopx
--spring.datasource.password=ecshopx
--spring.flyway.enabled=true
--spring.data.redis.host=redis
--spring.data.redis.port=6379
--spring.data.redis.password=redispassword
--JWT_SECRET=${JWT_SECRET}
--common.product-model=${PRODUCT_MODEL:-platform}
--xxl.job.admin.addresses=http://xxl-job-admin:8080/xxl-job-admin
--xxl.job.accessToken=ecshopx-cron-dev
--xxl.job.executor.appname=ecshopx-executor
--xxl.job.executor.port=19999
volumes:
- ..:/data/httpd
- ecshopx-logs:/app/logs
networks: [ecshopx-dev]
volumes:
mysql-data:
name: ecshopx-dev-mysql-data
redis-data:
name: ecshopx-dev-redis-data
ecshopx-logs:
name: ecshopx-dev-app-logs
networks:
ecshopx-dev:
name: ecshopx-dev
driver: bridge