🔺 docker-compose.yml
MySQL8.0+Redis6.2.5+JDK(JDK+Build)
docker-compose.yml
version: '3.8'
services:
duty-mysql-major:
image: mysql:8.0
container_name: duty-mysql-major
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
ports:
- "8001:3306"
volumes:
- /etc/localtime:/etc/localtime
- ./duty-docker/mysql80/major/data:/var/lib/mysql
- ./duty-docker/mysql80/major/log:/var/log/mysql
#- ./duty-docker/mysql80/major/conf:/etc/mysql
environment:
- MYSQL_ROOT_PASSWORD=DZzuxZphYhnDOsxC
- MYSQL_DATABASE=dutywork
- MYSQL_USER=dutywork
- MYSQL_PASSWORD=DZzuxZphYhnDOsxC
- TZ=Asia/Shanghai
restart: always
duty-redis-major:
image: redis:6.2.5
container_name: duty-redis-major
ports:
- "8003:6379"
volumes:
- /etc/localtime:/etc/localtime
- ./duty-docker/redis62/major/data:/data
environment:
- TZ=Asia/Shanghai
command: redis-server --appendonly yes
restart: always
duty-server:
# 使用Dockerfile进行构建
build: .
image: dutyapp:latest
container_name: duty-server
ports:
- "4005:4005"
- "8005:8080"
links:
- duty-mysql-major
- duty-redis-major
volumes:
- /etc/localtime:/etc/localtime
- ./duty-docker/server/static:/duty-server/static
- ./duty-docker/server/logs:/duty-server/logs
environment:
- TZ=Asia/Shanghai
restart: always
Dockerfile
FROM openjdk:17.0.2
MAINTAINER Liixing <>
WORKDIR /duty-server
COPY ./target/DutyReportServer-0.0.1-SNAPSHOT.jar /duty-server/DutyReportServer-0.0.1-SNAPSHOT.jar
CMD java -Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:4005 -jar -Xmx1024M -Xms256M /duty-server/DutyReportServer-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev
jdk-17 + mongo-4.4.6 + mariadb-10.2 + keking/kkfileview
version: '3.8'
services:
elecapp:
image: elecapp:1.0
container_name: "elecapp-jdk17"
expose:
- "8080"
links:
- mongo
- maria
environment:
TZ: "Asia/Shanghai"
mongo:
image: mongo:4.4.6
container_name: "mongodb"
restart: always
ports:
- 27017:27017 #对外暴露停供服务的端口,正式生产的时候理论不用暴露。>?
volumes:
- ./data/mongo/database:/data/db # 挂载数据目录
- ./data/mongo/logs:/var/log/mongodb # 挂载日志目录
- ./data/mongo/conf.d:/etc/mongo # 挂载配置目录
# command: --config ./data/mongo/conf.d/mongod.conf # 配置文件
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
TZ: "Asia/Shanghai"
tty: true
maria:
image: mariadb:10.2
container_name: "mariadb"
ports:
- 3306:3306
volumes:
- ./data/maria/database:/var/lib/mysql
- ./data/maria/logs:/var/log/mysql
#- ./data/maria/conf.d/my.cnf:/etc/mysql/my.cnf>?
- ./data/maria/conf.d:/etc/mysql
environment:
MYSQL_USER: root
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
TZ: "Asia/Shanghai"
tty: true
kkfileview:
image: kkfile:1.0
container_name: "kkfileview"
ports:
- 8012:8012
links:
- elecapp
volumes:
- ./data/files:/data
environment:
TZ: "Asia/Shanghai"
docker-compose.yml
(add Nginx)
version: '3.8'
services:
nginx:
image: nginx
ports:
- 80:80
links:
- elecapp
- kkfileview
volumes:
- ./data/nginx/conf.d:/etc/nginx/conf.d
- ./data/nginx/logs:/logs/nginx
elecapp:
image: elecapp:1.0
container_name: "elecapp-jdk17"
expose:
- "8080"
links:
- mongo
- maria
environment:
TZ: "Asia/Shanghai"
mongo:
image: mongo:4.4.6
container_name: "mongodb"
restart: always
ports:
- 27017:27017 #对外暴露停供服务的端口,正式生产的时候理论不用暴露。>?
volumes:
- ./data/mongo/database:/data/db # 挂载数据目录
- ./data/mongo/logs:/var/log/mongodb # 挂载日志目录
- ./data/mongo/conf.d:/etc/mongo # 挂载配置目录
# command: --config ./data/mongo/conf.d/mongod.conf # 配置文件
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
TZ: "Asia/Shanghai"
tty: true
maria:
image: mariadb:10.2
container_name: "mariadb"
ports:
- 3306:3306
volumes:
- ./data/maria/database:/var/lib/mysql
- ./data/maria/logs:/var/log/mysql
#- ./data/maria/conf.d/my.cnf:/etc/mysql/my.cnf>?
- ./data/maria/conf.d:/etc/mysql
environment:
MYSQL_USER: root
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
TZ: "Asia/Shanghai"
tty: true
kkfileview:
image: kkfile:1.0
container_name: "kkfileview"
ports:
- 8012:8012
links:
- elecapp
volumes:
- ./data/files:/data
environment:
TZ: "Asia/Shanghai"
./data/nginx/nginx.conf
server {
listen 80;
access_log /logs/nginx/ElectronicTeachingPlatform.log;
error_log /logs/nginx/ElectronicTeachingPlatform.error.log;
location / {
proxy_pass http://elecapp:8080;
}
location /preview {
proxy_pass http://kkfileview:8012;
}
}