0

at the moment i am trying to develope a microservice which should be deployed on docker and kubernetes. I also got it working. The thing is that my docker image with 126mb is quite large so i wanted to use multi stage build in order to reduce size but i am only getting errors. The working file looks like this

FROM openjdk:8-jdk-alpine
ADD target/nameofjar.jar nameofjar.jar
EXPOSE 8080
ENTRYPOINT [ "java","-jar","nameofjar.jar" ]

I also tried to automate the maven springboot mvn clean and install process but it didnt work. I would appreciate your help.

Jonas
  • 121,568
  • 97
  • 310
  • 388
Lars Hamus
  • 11
  • 2
  • What error message do you get? When do you get the error message, when building the image or when running the container? – Jonas May 05 '21 at 20:48
  • 1
    How big is your jar? Multistage builds help when there are files required to build your final image that are not needed to run your application. If your jar close to 126mb I don't think you'll be able to achieve any significant reduction in size. – Mustafa May 05 '21 at 21:01
  • I asume that my commands are wrong i am quite new to docker. The Size is about 126 mb. Error with maven commands was during build of container. – Lars Hamus May 06 '21 at 09:13

0 Answers0