62 lines
2.0 KiB
Docker
62 lines
2.0 KiB
Docker
|
FROM openjdk:8-jdk-alpine
|
||
|
|
||
|
LABEL Garrett Mills <shout@garrettmills.dev>
|
||
|
|
||
|
RUN apk add --no-cache curl tar bash procps
|
||
|
|
||
|
# Downloading and installing Maven
|
||
|
ARG MAVEN_VERSION=3.6.3
|
||
|
ARG USER_HOME_DIR="/root"
|
||
|
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
|
||
|
|
||
|
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
|
||
|
&& echo "Downlaoding maven" \
|
||
|
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
|
||
|
\
|
||
|
&& echo "Unziping maven" \
|
||
|
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
|
||
|
\
|
||
|
&& echo "Cleaning and setting links" \
|
||
|
&& rm -f /tmp/apache-maven.tar.gz \
|
||
|
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
|
||
|
|
||
|
ENV MAVEN_HOME /usr/share/maven
|
||
|
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
|
||
|
|
||
|
# Downloading and installing Gradle
|
||
|
# 1- Define a constant with the version of gradle you want to install
|
||
|
ARG GRADLE_VERSION=4.10.3
|
||
|
|
||
|
# 2- Define the URL where gradle can be downloaded from
|
||
|
ARG GRADLE_BASE_URL=https://services.gradle.org/distributions
|
||
|
|
||
|
# 3- Define the SHA key to validate the gradle download
|
||
|
# obtained from here https://gradle.org/release-checksums/
|
||
|
ARG GRADLE_SHA=8626cbf206b4e201ade7b87779090690447054bc93f052954c78480fa6ed186e
|
||
|
|
||
|
# 4- Create the directories, download gradle, validate the download, install it, remove downloaded file and set links
|
||
|
RUN mkdir -p /usr/share/gradle /usr/share/gradle/ref \
|
||
|
&& echo "Downlaoding gradle hash" \
|
||
|
&& curl -fsSL -o /tmp/gradle.zip ${GRADLE_BASE_URL}/gradle-${GRADLE_VERSION}-bin.zip \
|
||
|
\
|
||
|
&& echo "Checking download hash" \
|
||
|
&& echo "${GRADLE_SHA} /tmp/gradle.zip" | sha256sum -c - \
|
||
|
\
|
||
|
&& echo "Unziping gradle" \
|
||
|
&& unzip -d /usr/share/gradle /tmp/gradle.zip \
|
||
|
\
|
||
|
&& echo "Cleaning and setting links" \
|
||
|
&& rm -f /tmp/gradle.zip \
|
||
|
&& ln -s /usr/share/gradle/gradle-${GRADLE_VERSION} /usr/bin/gradle
|
||
|
|
||
|
# 5- Define environmental variables required by gradle
|
||
|
ENV GRADLE_VERSION 4.10.3
|
||
|
ENV GRADLE_HOME /usr/bin/gradle
|
||
|
ENV GRADLE_USER_HOME /cache
|
||
|
|
||
|
ENV PATH $PATH:$GRADLE_HOME/bin
|
||
|
|
||
|
VOLUME $GRADLE_USER_HOME
|
||
|
|
||
|
CMD [""]
|