Skip to content

Commit

Permalink
Added docker-from-uberjar util folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Nov 1, 2023
1 parent b17e223 commit 4a2fd5e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docker-from-uberjar/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# IMPORTANT: This dockerfile is merely a fallback!
# The recommended way to build a docker image from this java project is using the jib maven plugin
# on the module lsq-pkg-docker-cli:
# mvn clean install
# mvn -pl :lsq-pkg-docker-cli jib:dockerBuild

# Building this Dockerfile requires buildkit:
# Ensure { "features": { "buildkit": true } } exists in /etc/docker/daemon.json
# (or wherever your deamon.json resides)

ARG home="/lsq"

# Final running image
FROM openjdk:11-jre-slim
ARG home
ENV HOME "$home"
# Import the lsq-cli jar from the build step
ADD lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar "$HOME/lsq-cli.jar"

# Using /data as working directory that will be shared with host for input/output files
WORKDIR /data
VOLUME [ "/data" ]

ENTRYPOINT ["java","-jar","$HOME/lsq-cli.jar"]
CMD ["-h"]

# Usage:
# docker run -it -v $(pwd):/data ghcr.io/aksw/lsq rx rdfize --endpoint=http://dbpedia.org/sparql virtuoso.dbpedia.log

10 changes: 10 additions & 0 deletions docker-from-uberjar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Helper docker file to build the image from an uberjar and thus avoid a full build.

For example, this git repository might be checked out on a remote server with only docker available.
In this case, the lsq jar could be built locally and copied to the remote server using `scp`.

The filename must match the pattern: `lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar`
This is also the file generated when running `make distjar` on the project root.

Once the uberjar is present, run `docker build .` to build the image.

6 changes: 6 additions & 0 deletions docker-from-uberjar/copy-uberjar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# In the project root, run "make distjar" to build the uberjar

cp ../lsq-pkg-parent/lsq-pkg-uberjar-cli/target/lsq-pkg-uberjar-cli-*-jar-with-dependencies.jar .

0 comments on commit 4a2fd5e

Please sign in to comment.