mirror of https://github.com/codevalet/master
42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
BUILDER_CONTAINER="codevalet/master-builder"
|
|
|
|
if [ "${1}" = "" ]; then
|
|
echo "The path to a plugin must be passed as the first argument";
|
|
exit 1;
|
|
fi;
|
|
|
|
if [ ! -d $1 ]; then
|
|
echo "The path \`${1}\` is not a directory";
|
|
exit 1;
|
|
fi;
|
|
|
|
tty --quiet
|
|
if [ $? -eq 0 ]; then
|
|
TTY="-ti"
|
|
fi;
|
|
|
|
# Ensure ~/.m2 exists to avoid letting the Docker daemon create the directory
|
|
# owned by the root user
|
|
mkdir -p $HOME/.m2 $HOME/.npm $HOME/.cache $HOME/.config $HOME/.yarn
|
|
|
|
|
|
pushd $1
|
|
if [ -f pom.xml ]; then
|
|
echo ">> Building ${1}"
|
|
exec docker run --rm ${TTY} \
|
|
-u $(id -u):$(id -g) \
|
|
-e MAVEN_CONFIG=/var/maven/.m2 \
|
|
-v $HOME/.m2:/var/maven/.m2 \
|
|
-v $HOME/.npm:/.npm \
|
|
-v $HOME/.cache:/.cache \
|
|
-v $HOME/.config:/.config \
|
|
-v $HOME/.yarn:/.yarn \
|
|
-v $PWD:/data \
|
|
-w /data \
|
|
${BUILDER_CONTAINER} \
|
|
mvn -Duser.home=/var/maven -e -B -U -DskipTests install
|
|
fi;
|
|
popd
|