Skip to content

Add Dockerfile - #849

Merged
karussell merged 2 commits into
graphhopper:masterfrom
edy:dockerfile
Oct 28, 2016
Merged

karussell merged 2 commits into
graphhopper:masterfrom
edy:dockerfile

Conversation

@edy

@edy edy commented Oct 26, 2016 •

Copy link
Copy Markdown
Contributor

As promised, I created a simple Dockerfile for GraphHopper.

Build an image:
docker build -t graphhopper:master .

Run tests:
docker run -it graphhopper:master ./maven/bin/mvn clean test verify

Run graphhopper:
docker run -it -p 8989:8989 -v /home/username/graphhopper-maps/:/data graphhopper:master ./graphhopper.sh web /data/europe-latest.osm.pbf

You could add this Project to docker hub and let them build the images for you, which everyone can use.

Please let me know if there is something i should change.

Build an image:
docker build -t graphhopper:master .

Run tests:
docker run -it graphhopper:master ./maven/bin/mvn clean test verify

Run graphhopper:
docker run -it -p 8989:8989 -v /home/username/graphhopper-maps/:/data graphhopper:master /graphhopper.sh web /data/europe-latest.osm.pbf
@stefpb

stefpb commented Oct 26, 2016

Copy link
Copy Markdown

+1

@karussell

Copy link
Copy Markdown
Member

Thanks a lot! As we have currently already many files in the project root, is it possible to move the 2 new docker files to e.g. core/files or would it make things ugly/complicated?

@karussell

Copy link
Copy Markdown
Member

And I assume switching to a stable branch like 0.8 is possible via

docker build -t graphhopper:0.8 .

Or what does graphhopper:master mean?

@edy

edy commented Oct 27, 2016 •

Copy link
Copy Markdown
Contributor Author

If I move the Dockerfile to core/files, then it would be impossible to COPY the repository data into the docker image.

The path must be inside the context of the build; you cannot COPY ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon. -- https://docs.docker.com/engine/reference/builder/#/copy

graphhopper:master was just an example for a tag name of the docker image. One would build an image of the 0.8 branch by first checking it out and then use docker build -t graphhopper:0.8 .
https://docs.docker.com/engine/reference/commandline/build/#/tag-image--t

@edy

edy commented Oct 27, 2016 •

Copy link
Copy Markdown
Contributor Author
  1. There could be a Dockerfile in core/files which downloads the released zip files, like i did in edy/graphhopper-docker@668ea55
  2. We could also clone the repository like here: edy/graphhopper-docker@1f25f50
  3. is like 2., but you create a new repository for the dockerfile which clones the main repository

@karussell

Copy link
Copy Markdown
Member

Hmmh, difficult. I thought I could just fetch the docker file and work with it (install it etc) without being attached to any repository or data?

For normal production use I would prefer fetching the stable zip. But sometimes a tweak or bug fix is necessary. Maybe like in your 2nd suggestion but with git checkout 0.8?

graphhopper:master was just an example for a tag name of the docker image

Sorry, have not yet any idea of the concepts for docker :) which makes it a bit hard to decide what to do

@edy

edy commented Oct 27, 2016

Copy link
Copy Markdown
Contributor Author

Maybe like in your 2nd suggestion but with git checkout 0.8

I'd go with the 0th (Dockerfile inside the project root).

Pros:

  • you can git checkout your branch/tag/commit and build an image for this version
  • Docker Hub has automated builds which are triggered on pushes (commits or tags). Every pushed tag will create a new docker image tagged as eg. graphhopper:0.8.2

Cons:

  • two more files inside the project root 😃

My other suggestions require more work because the version number must be changed manually inside the Dockerfile on every new release.

@karussell
karussell merged commit 38ae7ba into graphhopper:master Oct 28, 2016
@karussell

Copy link
Copy Markdown
Member

Ok, thanks for the explanation - convinced & merged :)

markoscalderon pushed a commit to shippify/graphhopper that referenced this pull request Apr 7, 2017
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