Initial commit

This commit is contained in:
Thomas Nordquist 2017-07-19 12:54:37 +02:00
commit 1bf8b18af9
4 changed files with 95 additions and 0 deletions

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM openjdk:8-jre
# Install pbzip2 for parallel extraction
RUN apt-get update \
&& apt-get -y install \
pbzip2 \
wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /photon
ADD http://photon.komoot.de/data/photon-0.2.7.jar /photon/photon.jar
COPY entrypoint.sh ./entrypoint.sh
VOLUME /photon/photon_data
EXPOSE 2322
ENTRYPOINT /photon/entrypoint.sh

48
README.md Normal file
View File

@ -0,0 +1,48 @@
[![GitHub issues](https://img.shields.io/github/issues/thomasnordquist/photon-docker.svg)](https://github.com/thomasnordquist/photon-docker/issues) [![GitHub stars](https://img.shields.io/github/stars/thomasnordquist/photon-docker.svg)](https://github.com/thomasnordquist/photon-docker/stargazers) [![GitHub forks](https://img.shields.io/github/forks/thomasnordquist/photon-docker.svg)](https://github.com/thomasnordquist/photon-docker/network)
Have your own geocoder up and running within the hour, you will require about 60GB of disk space.
Feel free to fork and improve
# Run
The image itself is pretty small, the first time the container is executed, a 30GB searchindex will be downloaded.
The data volume is exposed as `/photon/photon_data` and can be mounted, this way you'll only have to download the data once.
## With `docker run`
```
docker run -p 2322:2322 -it thomasnordquist/photon-geocoder:latest
```
## Build and run from git
https://github.com/thomasnordquist/photon-docker
### With docker-compose
```
docker-compose build
docker-compose up
```
*Note: if you abort the download, you have to remove the volume `photon_data` before restarting the container*
### Without docker-compose
```
docker build --tag thomasnordquist/photon-geocoder:latest .
docker run -p 2322:2322 -it thomasnordquist/photon-geocoder:latest
```
## FAQ
- How do I pass arguments to the `photon.jar` ?
*The entrypoint accepts arguments for the `photon.jar`, you can invoke it by using `docker exec`*
- Do I need to have nominatim ?
*The container downloads the latest prebuilt search index, there is no immediate need to have nominatim installed.*
- What is photon ?
*photon is a geocoder, check out ***[their website](https://photon.komoot.de/)*** and their ***[github repository](https://github.com/komoot/photon)****

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '2'
services:
photon:
build:
context: .
dockerfile: Dockerfile
image: thomasnordquist/photon-geocoder:latest
volumes:
- data:/photon/photon_data
ports:
- 2322:2322
volumes:
data:
driver: local

15
entrypoint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Download elasticsearch index
if [ ! -d "/photon/photon_data/elasticsearch" ]; then
echo "Downloading search index"
wget -O - http://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | bzip2 -cd | tar x
fi
# Start photon if elastic index exists
if [ -d "/photon/photon_data/elasticsearch" ]; then
echo "Start photon"
java -jar photon.jar $@
else
echo "Could not start photon, the search index could not be found"
fi