Skip to content

Commit

Permalink
添加docker打包镜像的配置。
Browse files Browse the repository at this point in the history
  • Loading branch information
hellowHuaairen committed Apr 9, 2020
1 parent 42df32c commit d25eb18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM openjdk:8-jdk-alpine
#基础配置
FROM daocloud.io/library/java:8u40-b22
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ADD ${JAR_FILE} /home/app.jar
ADD src/main/resources/application.properties /home/conf/application.properties
WORKDIR /home/
EXPOSE 8082
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
ENTRYPOINT ["java","-jar","-Dspring.config.location=conf/application.properties","./app.jar"]
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>kuaidi</docker.image.prefix>
<docker.images.repository>kuaidi</docker.images.repository>
</properties>

<dependencies>
Expand Down Expand Up @@ -132,11 +133,16 @@
<!-- Docker maven plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.6</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<contextDirectory>${project.basedir}</contextDirectory>
<tag>${project.version}</tag>
<repository>${docker.images.repository}/${project.artifactId}</repository>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
Expand Down

0 comments on commit d25eb18

Please sign in to comment.