Skip to content

Commit 4eaae00

Browse files
committed
Add a way to share the local maven repo
1 parent a268801 commit 4eaae00

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ RUN apt-get update && apt-get install -y \
8787
&& update-locale LANG=${DEFAULT_LOCALE} LANGUAGE=${DEFAULT_LOCALE} LC_ALL=${DEFAULT_LOCALE}
8888

8989
COPY src/inputrc /home/silveruser/.inputrc
90+
COPY src/bash_aliases /home/silveruser/.bash_aliases
9091
COPY src/settings.xml /home/silveruser/.m2/
9192
COPY src/git_completion_profile /home/silveruser/.git_completion_profile
9293

run.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ while [[ $# -gt 0 ]]; do
1111
key="$1"
1212
case $key in
1313
-h)
14-
echo "Usage: run.sh [-i IMAGE_VERSION] [-w WORKING_DIR] [-n NAME]"
14+
echo "Usage: run.sh [-i IMAGE_VERSION] [-w WORKING_DIR] [-n NAME] [-s]"
1515
echo "Spawns and runs a container from the Docker image silverpeas/silverdev at a given version."
1616
echo "In order to build the projects in that container, the working directory of your projects"
1717
echo "will be mounted in the container. It checks if a Maven settings settings-docker.xml exist"
@@ -28,6 +28,7 @@ while [[ $# -gt 0 ]]; do
2828
echo " will be mounted to /home/silveruser/projects. By default nothing to"
2929
echo " mount."
3030
echo " -n NAME a name to give to the container. By default silverdev-IMAGE_VERSION."
31+
echo " -s to share the local Maven repository of the host with the container."
3132
exit 0
3233
;;
3334
-i)
@@ -45,6 +46,10 @@ while [[ $# -gt 0 ]]; do
4546
shift # past argument
4647
shift # past value
4748
;;
49+
-s)
50+
maven_repo="-v ${HOME}/.m2/repository:/home/silveruser/.m2/repository"
51+
shift # past argument
52+
;;
4853
*)
4954
die "Unknown option: $1"
5055
;;
@@ -57,7 +62,8 @@ if [[ -f "$HOME"/.m2/settings-docker.xml ]]; then
5762
else
5863
settings="$HOME"/.m2/settings.xml
5964
fi
60-
docker run -it ${working_dir} -v "${settings}":/home/silveruser/.m2/settings.xml \
65+
docker run -it ${working_dir} ${maven_repo} \
66+
-v "${settings}":/home/silveruser/.m2/settings.xml \
6167
-v "$HOME"/.m2/settings-security.xml:/home/silveruser/.m2/settings-security.xml \
6268
-v "$HOME"/.gitconfig:/home/silveruser/.gitconfig \
6369
-v "$HOME"/.ssh:/home/silveruser/.ssh \

src/bash_aliases

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
alias build='mvn clean install -PskipMinify'
2+
alias mk='mvn install -PskipMinify -Dmaven.test.skip=true'
3+
alias cmk='mvn clean install -PskipMinify -Dmaven.test.skip=true'
4+
alias dist='mvn clean install'

0 commit comments

Comments
 (0)