cicd-applied-to-spring-boot-java-app icon indicating copy to clipboard operation
cicd-applied-to-spring-boot-java-app copied to clipboard

Some problems to note

Open rubensa opened this issue 6 years ago • 1 comments

First of all, thank you for sharing. It was very useful.

But I must notice some problems:

  • You don't need to link your Docker repository with GitHub: As we are deploying to DockerHub using maven, DockerHub does not need to try to build the Docker image directly using the Dockerfile form GitHub. That said, If you download your Docker images (for example your current last build you can check that they don't work as expected. The problems in not with the enconding (as you pointed in the article). The problem is that the image is built by DockerHub and includes your repository source code in an app.jar directory inside the image, not the app.jar generated by maven (as the DockerHub does not run maven). If you link your DockerHub repository with your GitHub repository, everything needed by your Dockerfile must be in the git repo (or accesible by the build using curl or something).
  • Something similar is with Heroku. You can tell Heroku to build and deploy your app (linking Heroku with GitHub) or you can build your app with maven and send it to Heroku (using heroku-maven-plugin). Your approach uses the last option so is Travis CI the responsible for building and sending the generated jar to Heroku.
  • Other aspect to take into account is your Dockerfile base image. Using jre instead of jdk is enough for the case (and the image size is smaller)
  • Also notice, that deploying an exploded jar is considered much better than deploying a fat jar (see Spring Boot with Docker Getting Started Guide) as you can reuse the layers with the dependencies an only update the layer with your application code.

Hopes this helps you :)

rubensa avatar Feb 05 '20 20:02 rubensa

Hi @rubensa , First of all, thanks for this issue. I'm really sorry that it's only now I come back to you. I will take time to figure out this issue in order to improve the code. Sorry for the delay, I really appreciate your contribution. Have a nice day!

FanJups avatar Mar 06 '20 07:03 FanJups