Skip to content

Docker conventions and thoughts - #1212

Merged
karussell merged 1 commit into
graphhopper:masterfrom
legraina:master
Dec 13, 2017
Merged

karussell merged 1 commit into
graphhopper:masterfrom
legraina:master

Conversation

@legraina

@legraina legraina commented Nov 4, 2017

Copy link
Copy Markdown
Contributor

I've modified the Dockerfile and the docker-compose to use Docker conventions.
You now have an entrypoint in the Dockerfile and only a command in the docker-compose.yml file.

What's more, I think you should create your own docker image on docker hub (https://docs.docker.com/docker-hub/repos/#searching-for-images) and also perhaps create automatic builds (https://docs.docker.com/docker-hub/github/#github-service-hooks). I could do it, but I think you should create your own ids and organization on docker hub. I could also provide help if necessary.

@karussell

Copy link
Copy Markdown
Member

Thanks! What is the improvement here? (sorry I'm kind of a docker newb ;))

but I think you should create your own ids and organization on docker hub. I could also provide help if necessary

Can we deploy a new docker image everytime travis runs successfully or for every tagged release or something?

@legraina

legraina commented Nov 5, 2017 •

Copy link
Copy Markdown
Contributor Author

The improvement is that most of the people are using an entrypoint and then a command: when the docker starts, it run the entrypoint + command. In the entrypoint (here ./graphhopper web), you put the basics that normally a user won't owerride, the command is used by the final user to put its options (here the map that the server will run).
Most of the common docker images are using an entrypoint that runs a script docker-entrypoint.sh (nginx, redis, mongod, ...), and it's now the common way of building a docker image. The docker-entrypoint.sh runs all commands that need to be executed each time the docker image starts.

We could also declare some of the environment variables in the Dockerfile and override them if needed (as the JETTY_PORT or the JAVA_OPTS), but I do not know what should be the basic behavior.

You will deploy a new image, every time travis runs correctly. The image that corresponds to the master branch will automatically be tagged with latest (no specific tag is needed), and for the stable, you will just add the number of the version as a tag. You could also add a tag docker on every stable branch that needs to be deployed. In travis, you should also be able to recover the name of the branch.
Finally, you can use directly, Docker hub for building and deploying your image (without Travis): it's a lot easier as docker hub automates the whole process, but it needs a whole access to your repo. It will also manage all the different build and images.

With these improvements, people will be able to run graphhopper without downloading the git repo. You will just need in the dockerfile 'FROM graphhopper/graphhopper' or in the docker-compose to use 'image: graphhopper/graphhopper'

I hope that it's clearer.

@Dexyon

Dexyon commented Nov 6, 2017

Copy link
Copy Markdown

I love the idea of having you guys maintaining your own DockerHub account and push out some images. Github/ Docker Hub is if full of people/projects who have done it for their own in the past and I think it will be good to publish your own. Even just for centralising all discussions and best practices in a single place which is trusted by people.

As @legraina already mentioned, there are enough people who are willing to lend a helping hand. I would not mind helping out a bit on the docker (or Kubernetes) side. We have been using GH for about two years in a Docker / Kubernetes set-up!

Some comments on the Dockerfile. I personally always tend to use a fixed version of Java SDK's base images. We are now using openjdk:8-jdk. This is ok if you want to keep all your images based upon the latest sources. But maybe consider using a fixed version. I agree that this is more a personal preference, since I love to keep control over which exact base images are used.

@legraina

legraina commented Nov 7, 2017

Copy link
Copy Markdown
Contributor Author

I have updated the Dockerfile to have all the necessary information. The docker can be run with:

docker build -t graphhopper . 
docker run -v /absolute/path/to/data/:/data -p 80:11111 graphhopper

@karussell

Copy link
Copy Markdown
Member

Would you mind squashing the commits and also add yourself to contributors file and state that you accept the CLA? (can be same or different commit but signed)

@Dexyon would you mind to have a look into these changes here?

@legraina

Copy link
Copy Markdown
Contributor Author

I think I've done everything needed (I'm not sure as it's the first time I'm using squash and signing a commit).

@karussell

Copy link
Copy Markdown
Member

Would you state "agrees to the project's CLA" also in the contributors file?

Also I need just two (or one) commits, currently there are 9. Another possibility would be to create a new pull request with just the CLA and 1 signed commit that I would merge. Then I could squash&merge on my own and no more complication. (see #1208)

@legraina
legraina force-pushed the master branch 2 times, most recently from 4577a82 to 388ad96 Compare December 12, 2017 22:06
@legraina

legraina commented Dec 12, 2017 •

Copy link
Copy Markdown
Contributor Author

I think it's correctly done now. Do you need any help for creating the docker image on DockerHub ?

@karussell
karussell merged commit 36a3ca0 into graphhopper:master Dec 13, 2017
@karussell

Copy link
Copy Markdown
Member

Thanks!

Do you need any help for creating the docker image on DockerHub ?

We would need to find an automated way to avoid any manual triggers. Is this somehow possible after e.g. a github release/tag?

@legraina

Copy link
Copy Markdown
Contributor Author

It can been done really easily on DockerHub. You don't need any tag, you just need to grant access on DockerHub to all your git repositories. I can create everything and then transfer ownership. Is graphhopper a great name for the organization and the docker image ?

@karussell

Copy link
Copy Markdown
Member

I think I've done something that publishes the latest stuff :) ?
https://hub.docker.com/r/graphhopper/graphhopper/builds/

@karussell karussell added this to the 0.10 milestone Dec 13, 2017
@legraina

Copy link
Copy Markdown
Contributor Author

That's exactly what you need. Nothing else. What you can also do is following the other branches that correspond to previous releases (it can be done in DockerHub), you can also add the tag stable to the latest stable version. Finally, you can add a markdown to the README.md for the docker, for example: Docker Build Status. And you are done 👍 Many thanks :)

@legraina

Copy link
Copy Markdown
Contributor Author

I've seen that you have added the stable flag, however I've realized that the corresponding Dockerfile (for the branch 0.9) is not working the same way. I think you should add the stable tag when the branch 1.0 will be pushed.

@karussell

Copy link
Copy Markdown
Member

There will no 1.0 in the near future or do you mean 0.10? Maybe I can modify 0.9 and use the latest Dockerfile?

@legraina

Copy link
Copy Markdown
Contributor Author

Yes, I mean 0.10. You can modify the 0.9, it should work !!

@Dexyon

Dexyon commented Dec 15, 2017

Copy link
Copy Markdown

The dockerfile looks fine. I usually try to take a more specific version of the Java JDK instead of relying on the latest tag here. But that is just my opinion. Latest and greatest is also a good choice :)

@karussell

Copy link
Copy Markdown
Member

Would you mind to have a look into #1250 @legraina?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants