-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rtuszik/docker_image
fixed, dockerfile, update docker image
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
FROM openjdk:21-jdk | ||
FROM adoptopenjdk/openjdk11 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Define an argument to accept the Photon version | ||
# Install necessary tools | ||
RUN apt-get update && apt-get install -y wget pbzip2 curl | ||
|
||
# Define build argument for Photon version | ||
ARG PHOTON_VERSION | ||
|
||
# Download the Photon JAR file for the specified version | ||
RUN curl -L -o photon.jar https://github.com/komoot/photon/releases/download/${PHOTON_VERSION}/photon-${PHOTON_VERSION}.jar | ||
# Download the specified Photon release | ||
RUN wget https://github.com/komoot/photon/releases/download/${PHOTON_VERSION}/photon-${PHOTON_VERSION}.jar -O photon.jar | ||
|
||
# Copy the startup script | ||
COPY start-photon.sh /app/start-photon.sh | ||
RUN chmod +x /app/start-photon.sh | ||
|
||
# Expose the default Photon port | ||
EXPOSE 2322 | ||
|
||
# Run the Photon server | ||
CMD ["java", "-jar", "photon.jar"] | ||
# Set the command to run the startup script | ||
CMD ["/app/start-photon.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DATA_DIR="/app/photon_data" | ||
INDEX_URL="https://download1.graphhopper.com/public/photon-db-latest.tar.bz2" | ||
|
||
# Function to download and extract the index | ||
download_and_extract_index() { | ||
echo "Downloading and extracting the Photon index..." | ||
mkdir -p "$DATA_DIR" | ||
wget -O - "$INDEX_URL" | pbzip2 -cd | tar x -C "$DATA_DIR" | ||
echo "Index downloaded and extracted successfully." | ||
} | ||
|
||
# Check if the index already exists | ||
if [ ! -d "$DATA_DIR" ] || [ -z "$(ls -A "$DATA_DIR")" ]; then | ||
download_and_extract_index | ||
else | ||
echo "Photon index already exists. Skipping download." | ||
fi | ||
|
||
# Start Photon | ||
echo "Starting Photon..." | ||
exec java -jar photon.jar -data-dir "$DATA_DIR" |