@@ -5,41 +5,64 @@ function die() {
5
5
exit 1
6
6
}
7
7
8
+ image_name=" silverpeas/silverdev"
8
9
image_version=latest
9
10
name=" silverdev-${image_version} "
10
11
while [[ $# -gt 0 ]]; do
11
12
key=" $1 "
12
13
case $key in
13
- -h)
14
- echo " Usage: run.sh [-i IMAGE_VERSION] [-w WORKING_DIR] [-n NAME] [-s]"
15
- echo " Spawns and runs a container from the Docker image silverpeas/silverdev at a given version."
16
- echo " "
17
- echo " In order to build the projects in that container, the working directory of your projects"
18
- echo " could be mounted in the container. Your IDE, on the host, could be also accessible to the"
19
- echo " container by mounting the directory into which it is installed."
20
- echo " It checks if a Maven settings settings-docker.xml exist in order to use it in the container."
21
- echo " Otherwise, it is your settings.xml that will be used."
22
- echo " The following files or directories will be also used in the container: "
23
- echo " - The Maven security configuration settings-security.xml"
24
- echo " - The Git configuration .gitconfig"
25
- echo " - The ssh configuration directory .ssh"
26
- echo " - The GPG configuration directory .gnupg"
27
- echo " "
28
- echo " with:"
29
- echo " -i IMAGE_VERSION the version of the Docker image to instantiate. By default latest."
30
- echo " -w WORKING_DIR the path of your working directory to mount The working directory"
31
- echo " will be mounted to /home/silveruser/projects. By default nothing to"
32
- echo " mount."
33
- echo " -a APP_DIR the path of the directory in which your IDE is installed or the home"
34
- echo " directory of the IDE. It will be mounted to /home/silveruser/apps."
35
- echo " You can also by this way share your other programs to the container."
36
- echo " By default nothing to mount."
37
- echo " -n NAME a name to give to the container. By default silverdev-IMAGE_VERSION."
38
- echo " -s to share the local Maven repository of the host with the container."
14
+ -h|--help)
15
+ echo " " " Usage: run.sh [-i [IMAGE_NAME:]IMAGE_VERSION] [-w WORKING_DIR] [-n NAME] [-s]
16
+
17
+ Spawns and runs a container from the Docker image silverpeas/silverdev at a
18
+ given version.
19
+
20
+ In order to build the Silverpeas projects in that container, you have two
21
+ possible options:
22
+ - Either mounting the working folder containing the projects in the host on the
23
+ container;
24
+ - Either fetching the projects from your SCM in the container.
25
+ Your IDE, on the host, could be also accessible to the container by mounting on
26
+ it the directory in which it is installed.
27
+
28
+ The script checks if a Maven settings file settings-docker.xml exists in order
29
+ to use it in the container. Otherwise, your settings.xml will be used.
30
+
31
+ The following files or directories will be also used in the container:
32
+ - The Maven security configuration settings-security.xml;
33
+ - The Git configuration .gitconfig;
34
+ - The ssh configuration directory .ssh;
35
+ - The GPG configuration directory .gnupg;
36
+
37
+ With:
38
+ -i [IMAGE_NAME:]IMAGE_VERSION
39
+ the name and the version of the Docker image to instantiate.
40
+ The name is the one with which you have built the Docker image.
41
+ By default the name is silverpeas/silverdev.
42
+ By default the version is latest.
43
+ -w WORKING_DIR
44
+ the path of your working directory to mount. The working folder
45
+ will be mounted on the /home/silveruser/projects directory in
46
+ the container.
47
+ By default nothing to mount. You have to fetch yourself the
48
+ projects.
49
+ -a APP_DIR
50
+ the path of the directory in which your IDE is installed or the
51
+ home directory of the IDE. It will be mounted on the
52
+ /home/silveruser/apps folder in the container. You can also by
53
+ this way to share your other programs with the container.
54
+ By default nothing to mount.
55
+ -n NAME
56
+ a name to give to the container.
57
+ By default silverdev-IMAGE_VERSION.
58
+ -s
59
+ to share the local Maven repository of the host with the container.
60
+ " " "
39
61
exit 0
40
62
;;
41
63
-i)
42
- image_version=" $2 "
64
+ image_version=` echo " $2 " | cut -d ' :' -f 2`
65
+ test " $2 " = " $image_version " || image_name=` echo " $2 " | cut -d ' :' -f 1`
43
66
shift # past argument
44
67
shift # past value
45
68
;;
@@ -83,5 +106,6 @@ docker run -it -e DISPLAY=${DISPLAY} ${working_dir} ${app_dir} ${maven_repo} \
83
106
-v " $HOME " /.gitconfig:/home/silveruser/.gitconfig \
84
107
-v " $HOME " /.ssh:/home/silveruser/.ssh \
85
108
-v " $HOME " /.gnupg:/home/silveruser/.gnupg \
109
+ --privileged \
86
110
--name ${name} \
87
- silverpeas/silverdev :${image_version} /bin/bash
111
+ ${image_name} :${image_version} /bin/bash
0 commit comments