File tree Expand file tree Collapse file tree 1 file changed +38
-9
lines changed Expand file tree Collapse file tree 1 file changed +38
-9
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
33function allOSRealPath() {
4- case $1 in
5- /* ) echo " $1 " ; exit ;;
6- * ) echo " $PWD /${1# ./ } " ; exit ;;
7- esac
4+ if isOSWindows
5+ then
6+ path=" "
7+ case $1 in
8+ .* ) path=" $PWD /${1# ./ } " ;;
9+ /* ) path=" $1 " ;;
10+ * ) path=" /$1 " ;;
11+ esac
12+
13+ echo " /$path " | sed -e ' s/\\/\//g' -e ' s/://' -e ' s/./\U&/3'
14+ else
15+ case $1 in
16+ /* ) echo " $1 " ; exit ;;
17+ * ) echo " $PWD /${1# ./ } " ; exit ;;
18+ esac
19+ fi
20+ }
21+
22+ function isOSWindows() {
23+ if [ $OSTYPE == " msys" ]
24+ then
25+ return 0
26+ else
27+ return 1
28+ fi
829}
930
1031function usage {
6283
6384if [ -z " $source_dir " ]
6485then
65- source_dir=" $( pwd ) "
86+ source_dir=$( allOSRealPath $PWD )
6687else
6788 source_dir=$( allOSRealPath $source_dir )
6889fi
6990
70- docker_command=" docker run -it -v /var/run/docker.sock:/var/run/docker.sock -e \
71- \" IMAGE_NAME=$image_name \" -e \
91+ docker_command=" docker run -it "
92+ if isOSWindows
93+ then
94+ docker_command+=" -v //var/run/docker.sock:/var/run/docker.sock -e "
95+ else
96+ docker_command+=" -v /var/run/docker.sock:/var/run/docker.sock -e "
97+ fi
98+
99+ docker_command+=" \" IMAGE_NAME=$image_name \" -e \
72100 \" ARTIFACTS=$( allOSRealPath $artifact_dir ) \" -e \
73101 \" SOURCE=$source_dir \" "
74102
@@ -89,7 +117,8 @@ if $awsconfig_flag
89117then
90118 if [ -d " $HOME /.aws" ]
91119 then
92- docker_command+=" -e \" AWS_CONFIGURATION=$HOME /.aws\" "
120+ configuration_file_path=$( allOSRealPath " $HOME /.aws" )
121+ docker_command+=" -e \" AWS_CONFIGURATION=$configuration_file_path \" "
93122 else
94123 docker_command+=" -e \" AWS_CONFIGURATION=NONE\" "
95124 fi
@@ -111,4 +140,4 @@ echo ""
111140echo $exposed_command
112141echo " "
113142
114- eval $docker_command
143+ eval $docker_command
You can’t perform that action at this time.
0 commit comments