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

feat: add Dockerfile to project #7

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
target
*.log
Dockerfile
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM maven:3.9.5-eclipse-temurin-21

# Install additional dependencies
RUN apt-get update && apt-get install -y \
curl \
tar \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*

# Set version of Graphhopper
ARG GH_VERSION=9.1-osm-reader-callbacks

# Download Graphhopper source code
RUN curl -L https://github.com/geofabrik/graphhopper/archive/refs/tags/${GH_VERSION}.tar.gz -o graphhopper.tar.gz
RUN mkdir -p /openrailrouting/graphhopper && tar -xzf graphhopper.tar.gz -C /openrailrouting/graphhopper --strip-components=1

# Remove tarball
RUN rm graphhopper.tar.gz

# Copy OpenRailRouting source code into the container
COPY . /openrailrouting

# Set working directory to OpenRailRouting
WORKDIR /openrailrouting

# Clear Maven repository to ensure a fresh build
RUN rm -rf ~/.m2/repository/*

# Build OpenRailRouting and Graphhopper using Maven
RUN mvn clean install -DskipTests

# Expose necessary ports and run the application
EXPOSE 8989

CMD java -Xmx2G -Xms512m \
-Ddw.graphhopper.graph.location=/openrailrouting/osm/data-gh \
-Ddw.graphhopper.datareader.file=${OSM_PATH} \
-jar target/railway_routing-1.0.0.jar server ./config.yml
Loading