使用如下Dockerfile构建镜像
# cat Dockerfile FROM moxm/java:1.8-full as builder WORKDIR /build ARG JAR_FILE=target/pig-register.jar COPY ${JAR_FILE} app.jar RUN java -Djarmode=layertools -jar app.jar extract && rm app.jar FROM openjdk:8-jre LABEL maintainer="[email protected]" ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" WORKDIR pig-register COPY --from=builder /build/dependencies/ ./ COPY --from=builder /build/snapshot-dependencies/ ./ COPY --from=builder /build/spring-boot-loader/ ./ COPY --from=builder /build/application/ ./ EXPOSE 8848 CMD sleep 30; java $JAVA_OPTS org.springframework.boot.loader.JarLauncher
参考:https://gitee.com/log4j/pig/blob/8ee3bc5a3919043f147ae06ae9e1714a6669d4da/pig-register/Dockerfile
标签:full,java,moxm,builder,jar,pig,build,COPY From: https://www.cnblogs.com/a120608yby/p/17164288.html