diff --git a/README.adoc b/README.adoc index 3db30497..b3f326cf 100644 --- a/README.adoc +++ b/README.adoc @@ -94,9 +94,12 @@ working directory at the `/workspace` volume, for example assuming the current d [source] ---- -$ docker run -it --rm -v `(pwd)`:/workspace jreleaser/jreleaser-slim: [] +$ docker run -it --rm -v `(pwd)`:/workspace \ + jreleaser/: [] ---- +Where image may be `jreleaser-slim`, `jreleaser-alpine`. + NOTE: The `--basedir` argument will be automatically set to `--basedir=/workspace`. You may also need to map environment variables to the container, such as `JRELEASER_PROJECT_VERSION`, diff --git a/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/Dockerfile.tpl b/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/Dockerfile.tpl new file mode 100644 index 00000000..7891b30a --- /dev/null +++ b/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/Dockerfile.tpl @@ -0,0 +1,27 @@ +FROM {{dockerBaseImage}} + +{{#dockerLabels}} +LABEL {{.}} +{{/dockerLabels}} + +{{#dockerPreCommands}} +{{.}} +{{/dockerPreCommands}} + +COPY assembly/* / + +RUN unzip {{distributionArtifactFileName}} && \ + rm {{distributionArtifactFileName}} && \ + chmod +x {{distributionArtifactName}}/bin/{{distributionExecutable}} && \ + chmod +x {{distributionArtifactName}}/bin/java && \ + mv /{{distributionExecutable}}-entrypoint.sh /{{distributionArtifactName}}/bin && \ + chmod +x /{{distributionArtifactName}}/bin/{{distributionExecutable}}-entrypoint.sh + +ENV PATH="${PATH}:/{{distributionArtifactName}}/bin" + +{{#dockerPostCommands}} +{{.}} +{{/dockerPostCommands}} + +ENTRYPOINT ["/{{distributionArtifactName}}/bin/{{distributionExecutable}}-entrypoint.sh"] +CMD ["/{{distributionArtifactName}}/bin/{{distributionExecutable}}"] diff --git a/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/assembly/jreleaser-entrypoint.sh b/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/assembly/jreleaser-entrypoint.sh new file mode 100644 index 00000000..c2d1d93b --- /dev/null +++ b/src/jreleaser/distributions/jreleaser-standalone/alpine/docker/assembly/jreleaser-entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# if not running inside GitLab CI then specify the `jreleaser` command as default +if [ -z "${GITLAB_CI}" ] +then + ARGS="jreleaser" + WORKING_DIR="/workspace" +else + ARGS="" + WORKING_DIR="/" +fi + +cd $WORKING_DIR +exec $ARGS "$@" \ No newline at end of file diff --git a/src/jreleaser/distributions/jreleaser-standalone/slim/docker/Dockerfile.tpl b/src/jreleaser/distributions/jreleaser-standalone/slim/docker/Dockerfile.tpl new file mode 100644 index 00000000..7891b30a --- /dev/null +++ b/src/jreleaser/distributions/jreleaser-standalone/slim/docker/Dockerfile.tpl @@ -0,0 +1,27 @@ +FROM {{dockerBaseImage}} + +{{#dockerLabels}} +LABEL {{.}} +{{/dockerLabels}} + +{{#dockerPreCommands}} +{{.}} +{{/dockerPreCommands}} + +COPY assembly/* / + +RUN unzip {{distributionArtifactFileName}} && \ + rm {{distributionArtifactFileName}} && \ + chmod +x {{distributionArtifactName}}/bin/{{distributionExecutable}} && \ + chmod +x {{distributionArtifactName}}/bin/java && \ + mv /{{distributionExecutable}}-entrypoint.sh /{{distributionArtifactName}}/bin && \ + chmod +x /{{distributionArtifactName}}/bin/{{distributionExecutable}}-entrypoint.sh + +ENV PATH="${PATH}:/{{distributionArtifactName}}/bin" + +{{#dockerPostCommands}} +{{.}} +{{/dockerPostCommands}} + +ENTRYPOINT ["/{{distributionArtifactName}}/bin/{{distributionExecutable}}-entrypoint.sh"] +CMD ["/{{distributionArtifactName}}/bin/{{distributionExecutable}}"] diff --git a/src/jreleaser/distributions/jreleaser-standalone/slim/docker/assembly/jreleaser-entrypoint.sh b/src/jreleaser/distributions/jreleaser-standalone/slim/docker/assembly/jreleaser-entrypoint.sh new file mode 100644 index 00000000..3c1b9278 --- /dev/null +++ b/src/jreleaser/distributions/jreleaser-standalone/slim/docker/assembly/jreleaser-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# if not running inside GitLab CI then specify the `jreleaser` command as default +if [[ -z "${GITLAB_CI}" ]]; then + ARGS="jreleaser" + WORKING_DIR="/workspace" +else + ARGS="" + WORKING_DIR="/" +fi + +cd $WORKING_DIR +exec $ARGS "$@" \ No newline at end of file