Skip to content

tomasbjerre/runnable-jar-to-docker

Repository files navigation

Runnable Jar to Docker

NPM

Creates and publishes a Docker image with a runnable jar from Maven Central.

Example (will create this Dockerfile):

npx runnable-jar-to-docker \
 --docker-username tomasbjerre \
 --docker-password *** \
 --maven-group se.bjurr.gitchangelog \
 --maven-artifact git-changelog-command-line \
 --maven-version 1.102.0

Usage

Parameters:

Options:
  --docker-username <username>  Docker username
  --docker-password <password>  Docker password
  --maven-group <group>         Maven Group
  --maven-artifact <artifact>   Maven Artifact
  --maven-version <version>     Maven Package Version
  --compile-native              Given if the JAR should be compiled with GraalVM to native binary
  --dry-run                     Given if nothing should be done, just printed
  -h, --help                    display help for command

Example projects

Developer instructions

You may build it with:

npm run build

You can try it without release with:

npm run build \
 && node ./lib/cli.js \
  --docker-username tomasbjerre \
  --docker-password $dockerhub_token \
  --maven-group se.bjurr.violations \
  --maven-artifact violations-command-line \
  --maven-version 3.0.0 \
  --compile-native \
  --dry-run
docker run \
 --mount src="$(pwd)",target=/home/violations-command-line,type=bind \
 tomasbjerre/violations-command-line:3.0.0 \
 -v "FINDBUGS" src/test/resources/findbugs/ ".*main\.xml$" "Spotbugs"

Another example:

npm run build \
 && node ./lib/cli.js \
  --docker-username tomasbjerre \
  --docker-password $dockerhub_token \
  --maven-group se.bjurr.gitchangelog \
  --maven-artifact git-changelog-command-line \
  --maven-version 2.2.1 \
  --dry-run
docker run \
 --mount src="$(pwd)",target=/home/git-changelog-command-line,type=bind \
 tomasbjerre/git-changelog-command-line:2.2.1 \
 -std

Or open a shell:

docker run --rm -it --entrypoint sh tomasbjerre/git-changelog-command-line:2.2.1