Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile and instructions for building/running with Docker #339

Closed
paulczar opened this issue Jul 27, 2018 · 6 comments
Closed

Dockerfile and instructions for building/running with Docker #339

paulczar opened this issue Jul 27, 2018 · 6 comments
Labels

Comments

@paulczar
Copy link

Hi,

I submitted what I thought would be an noncontroversial PR (#338) for adding a Dockerfile and basic instructions on how to run petclinic in Docker. To my surprise it was closed rather than merged in.

I thought I should open an issue to explain my case more thoroughly for adding it in. I'm working on doing demos and tutorials for Kubernetes and tooling around it like Spinnaker and Knative of which I'll be presenting at conferences and other events such as Spring One Tour in Chicago and Istanbul.

Given I'll be presenting at some Spring events I feel its important to showcase Spring applications in my demonstrations, but at minimum to do this I need a Dockerfile in the repository (yes I could fork it and use my own version of the repo, but I'd rather people be able to replicate what I do using the original repos).

That aside as somebody who is not a Java developer let alone spring, I had no idea where to even start building this application into a .jar, let alone running it on a container platform like Kubernetes. I had to guess my way through compatible versions of openjdk and maven in order to be able to build it into a .jar and then run it. This is not the best experience for a new user or somebody interested in seeing what this whole Spring thing is all about.

At this stage most people have a familiarity with Docker and can run Docker images fairly simply in their development environments (Even Windows Laptops!) and having a Docker option means they don't need to install a JDK, Maven, Eclipse, etc on their machine just to start kicking the tires.

Hopefully I've made my case successfully and we can look at merging in my Dockerfile and instructions, or at least have a fruitful code review of it so that I can help in some way to make Spring a more approachable language to run on various cloud native platforms.

@trisberg
Copy link
Member

trisberg commented Jul 27, 2018

I have a branch that adds Docker, Kubernetes and Knative into the mix - planning on submitting a PR at some point - https://github.com/trisberg/spring-petclinic/tree/kubernetes

@paulczar
Copy link
Author

awesome @trisberg this will be a great building block towards that PR :)

@dsyer
Copy link
Member

dsyer commented Jul 30, 2018

You should be able to build in openjdk:8-alpine (petclinic doesn't require Maven to build, only a JDK). That might reduce the docker image churn? Probably a good idea to use a volume for the local maven cache (but I don't know if you can do that with vanilla docker without knowing the absolute path of the image on the host)?

@dsyer
Copy link
Member

dsyer commented Jul 30, 2018

I had no idea where to even start building this application into a .jar

I would open a separate issue about that if I were you. It doesn't really seem relevant to docker.

@dsyer
Copy link
Member

dsyer commented Jul 30, 2018

I don't have any problem with helping people to build a jar file, but I don't think this project needs a Dockerfile. I know a lot of people are forced to use Dockerfiles and build containers manually, but that's not an excuse for encouraging that pattern by exposing beginners (most of the target audience for Petclinic) to it needlessly. You only need a JDK to build and run the app, so lets make that clearer, and not confuse people by introducing other options.

There is a guide about building a docker container from a Spring Boot application at https://spring.io/guides/gs/spring-boot-docker/. Actually there are multiple different ways of doing it, so it's not really something we want to get into in this project.

If you need to give a demo and want a public repository to point to, there's nothing wrong with putting a Dockerfile in your fork of Petclinic IMO.

@snicoll
Copy link
Member

snicoll commented Jul 30, 2018

@paulczar I apologize if closing your original PR wasn't motivated enough. Hopefully, Dave's comment fixes that part.

Please report what was confusing about building the app in a separate issue and we'll have a look.

@snicoll snicoll closed this as completed Jul 30, 2018
dsyer pushed a commit that referenced this issue Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants