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

refactor: Docker setup #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM maven:3.8.4-openjdk-17 as maven

# copy source code and POM

WORKDIR /usr/src/morph-xr2rml

COPY morph-base morph-base
COPY morph-core morph-core
COPY morph-xr2rml-dist morph-xr2rml-dist
COPY morph-xr2rml-lang morph-xr2rml-lang
COPY morph-xr2rml-mongo morph-xr2rml-mongo
COPY morph-xr2rml-rdb morph-xr2rml-rdb
COPY pom.xml pom.xml

RUN mvn clean install

# find the fat JAR file and copy it to a fixed location
RUN JAR_FILE=$(ls morph-xr2rml-dist/target/*jar-with-dependencies.jar) && \
cp "$JAR_FILE" morph-xr2rml-dist/target/dist.jar

# ==================================================================================================

FROM openjdk:11-jdk-bullseye

RUN apt-get update -y && \
apt-get install -y && \
rm -rf /var/lib/apt/lists/*

ENV XR2RML="/morph-xr2rml"
RUN mkdir -p $XR2RML
WORKDIR "$XR2RML"

# copy the JAR file from the build stage
COPY --from=maven /usr/src/morph-xr2rml/morph-xr2rml-dist/target/dist.jar "$XR2RML"

ENV CONFIG="$XR2RML/config"
ENV OUTPUT="$XR2RML/output"
ENV LOG="$XR2RML/log"
RUN mkdir -p "$CONFIG" "$OUTPUT" "$LOG"

# Morph-xR2RML is not run at container startup, only when the run_xr2rml.sh script is run from outside.
# So instead just use sleep so that the container never kicks out.
CMD ["sleep", "infinity"]
18 changes: 4 additions & 14 deletions docker/docker-compose.yml → docker-compose.mongo.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
version: '3.2'
services:
networks:
xr2rml-net:
driver: bridge

services:
morph-xr2rml:
image: frmichel/morph-xr2rml:v1.3.2
container_name: morph-xr2rml
networks:
- xr2rml-net
volumes:
- "./xr2rml_config:/xr2rml_config"
- "./xr2rml_output:/xr2rml_output"
- "./log:/log"

mongo-xr2rml:
image: mongo:4.4.6
container_name: mongo-xr2rml
networks:
- xr2rml-net
volumes:
- "./mongo_db:/data/db"
- "./mongo_tools:/mongo_tools"
- "./mongo_import:/mongo_import"

networks:
xr2rml-net:
driver: bridge

8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.2'
services:
morph-xr2rml:
build: .
volumes:
- "./xr2rml_config:/xr2rml_config"
- "./xr2rml_output:/xr2rml_output"
- "./log:/log"
22 changes: 0 additions & 22 deletions docker/build/morph-xr2rml/Dockerfile

This file was deleted.