@@ -11,7 +11,7 @@ while [[ $# -gt 0 ]]; do
11
11
key=" $1 "
12
12
case $key in
13
13
-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] "
15
15
echo " Spawns and runs a container from the Docker image silverpeas/silverdev at a given version."
16
16
echo " In order to build the projects in that container, the working directory of your projects"
17
17
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
28
28
echo " will be mounted to /home/silveruser/projects. By default nothing to"
29
29
echo " mount."
30
30
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."
31
32
exit 0
32
33
;;
33
34
-i)
@@ -45,6 +46,10 @@ while [[ $# -gt 0 ]]; do
45
46
shift # past argument
46
47
shift # past value
47
48
;;
49
+ -s)
50
+ maven_repo=" -v ${HOME} /.m2/repository:/home/silveruser/.m2/repository"
51
+ shift # past argument
52
+ ;;
48
53
* )
49
54
die " Unknown option: $1 "
50
55
;;
@@ -57,7 +62,8 @@ if [[ -f "$HOME"/.m2/settings-docker.xml ]]; then
57
62
else
58
63
settings=" $HOME " /.m2/settings.xml
59
64
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 \
61
67
-v " $HOME " /.m2/settings-security.xml:/home/silveruser/.m2/settings-security.xml \
62
68
-v " $HOME " /.gitconfig:/home/silveruser/.gitconfig \
63
69
-v " $HOME " /.ssh:/home/silveruser/.ssh \
0 commit comments