mobile: docker run should require a $GOPATH/src volume mount.

If the volume is not accessible or -v option is not given,
docker run golang/mobile will fail with an error like:

finalize namespace chdir to /src/golang.org/x/mobile no such file or directory2015/01/13 20:14:19 Error response from daemon: Cannot start container dfe1dbc2bac3ea939e154eee13d20ecae4c473a595dbc1e6a0e5cf0be3963909: finalize namespace chdir to /src/golang.org/x/mobile no such file or directory

Change-Id: I4d56c044e9c7682e63da7170a546522230237b18
Reviewed-on: https://go-review.googlesource.com/2780
Reviewed-by: Burcu Dogan <jbd@google.com>
This commit is contained in:
Hyang-Ah (Hana) Kim
2015-01-14 18:59:42 +00:00
committed by Hyang-Ah Hana Kim
parent cf241b7ad2
commit d97f4d82bd
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -59,6 +59,9 @@ RUN curl -L https://github.com/golang/go/archive/master.zip -o /tmp/go.zip && \
./all.bash && \
CC_FOR_TARGET=$NDK_ROOT/bin/arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 ./make.bash
# Expect the GOPATH/src volume to be mounted. (-v $GOPATH/src:/src)
VOLUME ["/src"]
# Generate a debug keystore to avoid it being generated on each `docker run`
# and fail `adb install -r <apk>` with a conflicting certificate error.
RUN keytool -genkeypair -alias androiddebugkey -keypass android -keystore ~/.android/debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 365
+4
View File
@@ -34,6 +34,10 @@ To build, run:
docker run -v $GOPATH/src:/src mobile /bin/bash -c 'cd /src/your/project && ./make.bash'
Note the use of -v option to mount $GOPATH/src to /src of the container.
The above command will fail if the -v option is missing or the specified
volume is not accessible from the container.
When working with an all-Go application, this will produce a binary at
`$GOPATH/src/your/project/bin/name-debug.apk`. You can use the adb tool to install
and run this app. See all.bash for an example.