Home > Software engineering >  How do I make a Spring Boot app that others can run with Docker
How do I make a Spring Boot app that others can run with Docker

Time:04-29

I am trying to make a Spring Boot app that I can put on GitHub and then have others contribute. At first I thought I would need to use Docker because not everyone will be running the same version of java and thus they would not be able to contribute if they are not using the same version of Java (I think?). So my solution was to use Docker so that it would work on anybody's computer. So I set up the Dockerfile and then I realized that is not how development with Docker works. Every time I want to make a change in my Spring Boot app, I would have to make a new jar, and then build my image again and then make my container just to run it again. Obviously I got confused somewhere.

What would be the best way to make a Spring Boot app that can be cloned from git and anyone can work on it without having to do any work on their end (changing java versions or installing anything else)?

Here is my docker file in case you were curious.

FROM openjdk:8-jdk-alpine

ARG JAR_FILE=target/*.jar

COPY ${JAR_FILE} app.jar

EXPOSE 8080

ENTRYPOINT ["java","-jar","/app.jar"]

CodePudding user response:

You don't need to use docker, specify the java version you wan't, especially the language level to use. If you use maven etc. then also your dependencies are resolved by it and everyone with jdk and maven installed can work on it.

  • Related