首页 > 编程语言 > 详细

Docker中部署Tomcat,并且部署Java应用程序

时间:2018-09-05 00:07:39      阅读:159      评论:0      收藏:0      [点我收藏+]

Dockerfile

FROM tomcat:9.0-jre8-alpine
MAINTAINER louguanyang <louguanyang@hzsuidifu.com>

VOLUME /tmp

ARG JAR_FILE

RUN apk add -U tzdata

RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN echo "Asia/Shanghai" > /etc/timezone

RUN apk del tzdata

ADD ${JAR_FILE} /usr/local/tomcat/webapps

CMD ["catalina.sh", "run"]

  pom.xml

<!-- dockerfile-maven-plugin -->
<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>${dockerfile-maven-plugin.version}</version>
    <executions>
        <execution>
            <id>default</id>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
                <!--<goal>push</goal>-->
                <!--<goal>tag</goal>-->
            </goals>
        </execution>
    </executions>
    <configuration>
        <force>false</force>
        <repository>${docker.repository}/${docker.image.prefix}/${project.artifactId}</repository>
        <tag>${project.version}</tag>
        <buildArgs>
            <JAR_FILE>target/${project.build.finalName}.war</JAR_FILE>
        </buildArgs>
    </configuration>
</plugin>

  

Docker中部署Tomcat,并且部署Java应用程序

原文:https://www.cnblogs.com/louguanyang/p/9589058.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!