File tree Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change 15
15
16
16
### 服务器构建项目镜像
17
17
``` bash
18
+ # 在POM中声明构建信息: pom_pom.xml 使用Dockerfile: pom.xml + Dockerfile
19
+
18
20
# 进入项目目录
19
21
cd /root/answer/docker/springboot-mybatis-web
20
22
# 编译 Docker 镜像
Original file line number Diff line number Diff line change 89
89
<imageTag >latest</imageTag >
90
90
<!-- <imageTag>${project.version}</imageTag>-->
91
91
</imageTags >
92
- <!-- 镜像的FROM, 使用java官方镜像 | 构建镜像时需要的基础镜像, 类似于DockerFile的From -->
93
- <baseImage >java:8</baseImage >
94
- <!-- 该镜像的容器启动后, 直接运行spring boot工程 | 容器启动时执行的命令 -->
95
- <entryPoint >["java", "-jar", "/${project.build.finalName} .jar"]</entryPoint >
96
- <!-- <volumes>
97
- <volume>/home</volume>
98
- </volumes>
99
- -->
100
- <!-- 设置环境变量 | 类似于DockerDile的ENV -->
101
- <env >
102
- <MYSQL_IP >119.23.XXX.XXX</MYSQL_IP >
103
- <MYSQL_PORT >3306</MYSQL_PORT >
104
- <MYSQL_DB >answer</MYSQL_DB >
105
- <MYSQL_UNAME >root</MYSQL_UNAME >
106
- <MYSQL_PASSWD >123456</MYSQL_PASSWD >
107
- </env >
108
- <!-- 设定容器向外部暴露的端口 -->
109
- <exposes >
110
- <expose >8088</expose >
111
- </exposes >
92
+ <!-- Dockerfile 文件所在的目录 -->
93
+ <dockerDirectory >src/main/docker</dockerDirectory >
112
94
<!-- 这里是复制 jar 包到 docker 容器指定目录配置, 相当于DockerFile的ADD -->
113
95
<resources >
114
96
<resource >
You can’t perform that action at this time.
0 commit comments