Skip to content

Commit

Permalink
Ensure directories in .gradle are created by gradle user (closes #255)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Aug 16, 2023
1 parent e34b827 commit 53df38f
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 38 deletions.
9 changes: 7 additions & 2 deletions jdk11-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk11-focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk17-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
15 changes: 9 additions & 6 deletions jdk17-focal-graal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN set -o errexit -o nounset \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle
Expand Down Expand Up @@ -96,10 +97,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version \
\
# chown last so that it applies to /home/gradle/.gradle/native
&& chown --recursive gradle:gradle /home/gradle
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk17-focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
15 changes: 9 additions & 6 deletions jdk17-graal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN set -o errexit -o nounset \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle
Expand Down Expand Up @@ -96,10 +97,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version \
\
# chown last so that it applies to /home/gradle/.gradle/native
&& chown --recursive gradle:gradle /home/gradle
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk20-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
15 changes: 9 additions & 6 deletions jdk20-graal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN set -o errexit -o nounset \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle
Expand Down Expand Up @@ -96,10 +97,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version \
\
# chown last so that it applies to /home/gradle/.gradle/native
&& chown --recursive gradle:gradle /home/gradle
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk20/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk8-focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root
9 changes: 7 additions & 2 deletions jdk8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ RUN set -o errexit -o nounset \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

USER gradle

RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version

USER root

0 comments on commit 53df38f

Please sign in to comment.