Commit 3d94a3b2 authored by Robert D Birch's avatar Robert D Birch

maven docker images

parents
FROM java9-oracle
MAINTAINER bandlandia
ENV APPS_DIR=/opt
ARG MAVEN_VERSION=3.5.3
ARG USER_HOME_DIR="/opt"
ARG BASE_URL="http://apache.mirrors.ionfish.org/maven/maven-3/${MAVEN_VERSION}/binaries"
RUN wget -qO- ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar -xvz -C /opt \
&& ln -s ${APPS_DIR}/apache-maven-${MAVEN_VERSION}/bin/mvn /usr/bin/mvn \
&& ln -s ${APPS_DIR}/apache-maven-${MAVEN_VERSION} /opt/maven
ENV MAVEN_HOME="/${APPS_DIR}/maven"
ENV MAVEN_CONFIG="/opt/.m2"
COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY settings-docker.xml ${MAVEN_HOME}/ref/
RUN mvn --version
#! /bin/bash -eu
set -o pipefail
# Copy files from /usr/share/maven/ref into ${MAVEN_CONFIG}
# So the initial ~/.m2 is set with expected content.
# Don't override, as this is just a reference setup
copy_reference_file() {
local root="${1}"
local f="${2%/}"
local logfile="${3}"
local rel="${f/${root}/}" # path relative to /usr/share/maven/ref/
echo "$f" >> "$logfile"
echo " $f -> $rel" >> "$logfile"
if [[ ! -e ${MAVEN_CONFIG}/${rel} || $f = *.override ]]
then
echo "copy $rel to ${MAVEN_CONFIG}" >> "$logfile"
mkdir -p "${MAVEN_CONFIG}/$(dirname "${rel}")"
cp -r "${f}" "${MAVEN_CONFIG}/${rel}";
fi;
}
copy_reference_files() {
local log="$MAVEN_CONFIG/copy_reference_file.log"
if (sh -c "mkdir -p \"$MAVEN_CONFIG\" && touch \"${log}\"" > /dev/null 2>&1)
then
echo "--- Copying files at $(date)" >> "$log"
find /usr/share/maven/ref/ -type f -exec bash -eu -c 'copy_reference_file /usr/share/maven/ref/ "$1" "$2"' _ {} "$log" \;
else
echo "Can not write to ${log}. Wrong volume permissions? Carrying on ..."
fi
}
export -f copy_reference_file
copy_reference_files
unset MAVEN_CONFIG
exec "$@"
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/opt/maven/ref/repository</localRepository>
</settings>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment