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 1515
1616### 服务器构建项目镜像
1717``` bash
18+ # 在POM中声明构建信息: pom_pom.xml 使用Dockerfile: pom.xml + Dockerfile
19+
1820 # 进入项目目录
1921 cd /root/answer/docker/springboot-mybatis-web
2022 # 编译 Docker 镜像
Original file line number Diff line number Diff line change 8989 <imageTag >latest</imageTag >
9090 <!-- <imageTag>${project.version}</imageTag>-->
9191 </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 >
11294 <!-- 这里是复制 jar 包到 docker 容器指定目录配置, 相当于DockerFile的ADD -->
11395 <resources >
11496 <resource >
You can’t perform that action at this time.
0 commit comments