jkube
jkube copied to clipboard
Docker file optimization
Component
quickstarts
Task description
Description
Set environment variable and don't use it Lack of clear working directory setting: Not setting a clear working directory can reduce readability.
https://github.com/eclipse-jkube/jkube/blob/522baa2100fc95ea3ca27a0a6e1a6d43861e7182/quickstarts/maven/plugin/app/Dockerfile#L17
https://github.com/eclipse-jkube/jkube/blob/522baa2100fc95ea3ca27a0a6e1a6d43861e7182/quickstarts/gradle/plugin/app/Dockerfile#L19-L20
I think it would be better to fix it like this
FROM quay.io/jkube/jkube-java:0.0.15
ENV JAVA_APP_DIR=/deployments
**Set working directory**
WORKDIR ${JAVA_APP_DIR}
COPY maven/build/libs/*.jar app.jar
COPY maven/build/classes/java/main/jkube-extra/ files/
EXPOSE 8080
CMD ["java", "-jar", "app.jar"]
Or, it might be a good idea to delete Set working directory.
Expected Behavior
Setting working directory: By using the WORKDIR command to set the working directory, subsequent commands are now clearer. Improved readability: The overall structure has been organized to improve readability.