Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.93k stars 397 forks source link

Update tags for Maven and OpenJDK image in default Dockerfile #726

Closed arun-gupta closed 5 years ago

arun-gupta commented 6 years ago

Default Dockerfile generated for a Java sample application is:

FROM maven:3.5-jdk-8 as BUILD

COPY . /usr/src/app
RUN mvn --batch-mode -f /usr/src/app/pom.xml clean package

FROM openjdk:8-jdk
ENV PORT 4567
EXPOSE 4567
COPY --from=BUILD /usr/src/app/target /opt/target
WORKDIR /opt/target

CMD ["/bin/bash", "-c", "find -type f -name '*.jar' | xargs java -jar"]

Some suggested improvements:

. The suggested tag for maven should be 3-jdk-10 . The second stage of the build should use JRE instead of JDK. So, the suggested tag would be jre-slim instead 8-jdk. This will create a leaner image.

Identified during hacking with @michelleN at #KubeCon