File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ COPY buildInDocker.sh $GOPATH
6666RUN chmod 777 $GOPATH/buildInDocker.sh
6767
6868# Copy the rest of the source tree from this directory into the container
69+ # And make sure it's readable by the id that will run the compiles (not just root)
6970COPY . $GOPATH/src/$ORG/$REPO
71+ RUN chmod -R a+rx $GOPATH/src
7072
7173# Set the entrypoint to the script that will do the compilation
7274ENTRYPOINT $GOPATH/buildInDocker.sh
Original file line number Diff line number Diff line change 2020export PATH=" ${PATH} :/usr/lib/go-${GOVERSION} /bin:/go/bin"
2121export CGO_CFLAGS=" -I/opt/mqm/inc/"
2222export CGO_LDFLAGS_ALLOW=" -Wl,-rpath.*"
23+ export GOCACHE=/tmp/.gocache
24+
25+ echo " Running as " ` id`
2326
2427# Build the libraries so they can be used by other programs
2528cd $GOPATH /src
Original file line number Diff line number Diff line change 4242 rm -rf $OUTBINDIR $OUTPKGDIR > /dev/null 2>&1
4343 mkdir -p $OUTBINDIR $OUTPKGDIR
4444
45+ # The container will be run as the current user to ensure files
46+ # written back to the host image are owned by that person instead of root.
47+ uid=` id -u`
48+ gid=` id -g`
49+
4550 # Mount an output directory
4651 # Delete the container once it's done its job
4752 docker run --rm \
48- -v $OUTBINDIR :$GOPATH /bin:z \
49- -v $OUTPKGDIR :$GOPATH /pkg:z \
53+ --user $uid :$gid \
54+ -v $OUTBINDIR :$GOPATH /bin \
55+ -v $OUTPKGDIR :$GOPATH /pkg \
5056 $TAG :$VER
5157 echo " Compiled samples should now be in $OUTBINDIR "
5258fi
You can’t perform that action at this time.
0 commit comments