12345678910111213141516171819202122232425262728 |
- FROM maven:3.5-jdk-8 as base
- FROM openjdk:8-jdk-alpine
- # FROM openjdk:17-jdk-alpine
- RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
- COPY maven/settings.xml /root/.m2/settings.xml
- # ADD source dest
- FROM base as builder
- WORKDIR /app
- COPY . /app
- RUN mvn clean package && \
- mv target/springboot-note-0.0.1-SNAPSHOT.jar /app/target/springboot-note-0.0.1-SNAPSHOT.jar
- CMD [ "/bin/bash" ]
- FROM base as runner
- # USER java
- WORKDIR /app
- COPY --from=builder /app/target/springboot-note-0.0.1-SNAPSHOT.jar /app/target/springboot-note-0.0.1-SNAPSHOT.jar
- ARG JAVA_OPTS
- ENV JAVA_OPTS=$JAVA_OPTS
- EXPOSE 8080
- VOLUME [ "/app" ]
- # CMD [ "java", "-jar", "target/springboot-note-0.0.1-SNAPSHOT.jar"]
- ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
|