From 02a0c4a72c5b659a090e7c26dc0fa8cb3a23929c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 18:26:24 -0700 Subject: [PATCH 01/13] updating readme to reference versions 2018.07 and 2021.03 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index c19023f..b1b90eb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,19 @@ This image was built for use with Drone CI but can be used with any docker setup you want. +Versions are: + +- 2021.03 + - Go 1.15.10 + - Android API 29 +- 2018.07 + - Go 1.10.3 + - Android API 28 + +## Install and Use + +### Version 2018.07 + This image includes: - Android SDK, NDK, tools, and API version 28 at `/usr/local/android-sdk` From 558e189787481f833613acfb5169e15f8db2513f Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 16 Mar 2021 17:30:03 -0700 Subject: [PATCH 02/13] updating to go 1.16.2 and new Android tools version --- Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index a1103f3..283fc57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ FROM openjdk:8 ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \ ANDROID_HOME="/usr/local/android-sdk" \ - ANDROID_VERSION=28 \ - ANDROID_BUILD_TOOLS_VERSION=28.0.1 + ANDROID_VERSION=29 \ + ANDROID_BUILD_TOOLS_VERSION=30.0.2 ## Download Android SDK RUN mkdir "$ANDROID_HOME" .android \ @@ -33,7 +33,7 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" ## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf RUN echo 'hosts: files dns' > /etc/nsswitch.conf -ENV GOLANG_VERSION 1.10.3 +ENV GOLANG_VERSION 1.16.2 RUN set -eux; \ apt-get update; \ @@ -64,7 +64,7 @@ RUN set -eux; \ esac; \ \ wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \ - echo '567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2 *go.tgz' | sha256sum -c -; \ + echo '37ca14287a23cb8ba2ac3f5c3dd8adbc1f7a54b9701a57824bf19a0b271f83ea *go.tgz' | sha256sum -c -; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ @@ -88,5 +88,10 @@ ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" # install gomobile -RUN go get golang.org/x/mobile/cmd/gomobile -RUN gomobile init -ndk $ANDROID_HOME/ndk-bundle/ +RUN go install golang.org/x/mobile/cmd/gomobile@latest +RUN go install golang.org/x/mobile/cmd/gobind@latest + +#RUN go get -u golang.org/x/mobile +#RUN go get -u golang.org/x/mobile/bind + +# RUN gomobile init From b151e319bb03130025ba66f2af7f1d62dd203092 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 16:12:46 -0700 Subject: [PATCH 03/13] updating install directory to support two gopaths, one from drone and this one with gomobile --- Dockerfile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 283fc57..5daba1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,12 +78,9 @@ RUN set -eux; \ ENV PATH /usr/local/go/bin:$PATH # Setup /workspace -RUN mkdir /workspace -RUN mkdir /go -# link $GOPATH to persistent /go -RUN ln -sf /go /workspace/go +RUN mkdir /gomobile # Set up GOPATH in /workspace -ENV GOPATH /workspace/go +ENV GOPATH /gomobile:/go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" @@ -91,7 +88,5 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" RUN go install golang.org/x/mobile/cmd/gomobile@latest RUN go install golang.org/x/mobile/cmd/gobind@latest -#RUN go get -u golang.org/x/mobile -#RUN go get -u golang.org/x/mobile/bind - # RUN gomobile init + From 3471182d86700b2bb96950eaeb558fab8815110c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 17:01:35 -0700 Subject: [PATCH 04/13] fix PATH add --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5daba1c..0192450 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,7 +81,7 @@ ENV PATH /usr/local/go/bin:$PATH RUN mkdir /gomobile # Set up GOPATH in /workspace ENV GOPATH /gomobile:/go -ENV PATH $GOPATH/bin:$PATH +ENV PATH /gomobile/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" # install gomobile From 0a220e165eddaa0843ec7c94d3e9cda32ce87606 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 17 Mar 2021 18:02:43 -0700 Subject: [PATCH 05/13] more path fixes for gomobile and more android env vars attempting to point to android/log.h --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0192450..f1beb45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM openjdk:8 ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \ ANDROID_HOME="/usr/local/android-sdk" \ + ANDROID_SDK=$ANDROID_HOME \ ANDROID_VERSION=29 \ ANDROID_BUILD_TOOLS_VERSION=30.0.2 @@ -24,6 +25,7 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO # Install NDK RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" +ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle # Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile # Adapted from alpine apk to debian apt @@ -77,12 +79,13 @@ RUN set -eux; \ # persist new go in PATH ENV PATH /usr/local/go/bin:$PATH +ENV GOMOBILEPATH /gomobile # Setup /workspace -RUN mkdir /gomobile +RUN mkdir $GOMOBILEPATH # Set up GOPATH in /workspace -ENV GOPATH /gomobile:/go -ENV PATH /gomobile/bin:$PATH -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" +ENV GOPATH $GOMOBILEPATH:/go +ENV PATH $GOMOBILEPATH/bin:$PATH +RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH" # install gomobile RUN go install golang.org/x/mobile/cmd/gomobile@latest From 668d00246565b2114c788d419c724f0afa25230d Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 19 Mar 2021 15:10:40 -0700 Subject: [PATCH 06/13] trying go1.15 since 1.16 has issues (https://github.com/golang/go/issues/44500) --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f1beb45..0c182ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,8 @@ ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle ## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf RUN echo 'hosts: files dns' > /etc/nsswitch.conf -ENV GOLANG_VERSION 1.16.2 +ENV GOLANG_VERSION 1.15.10 +ENV GOLANG_SHA256 c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65 RUN set -eux; \ apt-get update; \ @@ -66,7 +67,7 @@ RUN set -eux; \ esac; \ \ wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \ - echo '37ca14287a23cb8ba2ac3f5c3dd8adbc1f7a54b9701a57824bf19a0b271f83ea *go.tgz' | sha256sum -c -; \ + echo "$GOLANG_SHA256 *go.tgz" | sha256sum -c -; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ @@ -88,8 +89,8 @@ ENV PATH $GOMOBILEPATH/bin:$PATH RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH" # install gomobile -RUN go install golang.org/x/mobile/cmd/gomobile@latest -RUN go install golang.org/x/mobile/cmd/gobind@latest +RUN go get golang.org/x/mobile/cmd/gomobile +RUN go get golang.org/x/mobile/cmd/gobind # RUN gomobile init From d8934fd9e7faaddf209e07acf95a8c84e23f35b4 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 17:27:45 -0700 Subject: [PATCH 07/13] rm /go from /home/dan/src/go, retool a smidge --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0c182ce..44b8aee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,13 +84,15 @@ ENV GOMOBILEPATH /gomobile # Setup /workspace RUN mkdir $GOMOBILEPATH # Set up GOPATH in /workspace -ENV GOPATH $GOMOBILEPATH:/go +ENV GOPATH $GOMOBILEPATH ENV PATH $GOMOBILEPATH/bin:$PATH RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH" # install gomobile RUN go get golang.org/x/mobile/cmd/gomobile RUN go get golang.org/x/mobile/cmd/gobind +RUN go get golang.org/x/mobile/bind +RUN gomobile clean # RUN gomobile init From da18b4e8ff13153234531f9dffdb929e17a21921 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 18:32:05 -0700 Subject: [PATCH 08/13] update readme for 2021.03 version --- Dockerfile | 2 -- README.md | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44b8aee..6c91028 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,5 +94,3 @@ RUN go get golang.org/x/mobile/cmd/gobind RUN go get golang.org/x/mobile/bind RUN gomobile clean -# RUN gomobile init - diff --git a/README.md b/README.md index b1b90eb..8db3dbf 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,21 @@ Versions are: ## Install and Use -### Version 2018.07 +### Version 2021.03 This image includes: -- Android SDK, NDK, tools, and API version 28 at `/usr/local/android-sdk` +- Android SDK, NDK, tools, and API version 29 and Buildtools 30.0.2 at `/usr/local/android-sdk` - Go lang 1.10.3 at `/usr/local/go` -- $GOPATH set to `/workspace/go` -- A go directory with an initialized gomobile installed at `/go` +- $GOPATH set to `/gomobile` + - GOPATH includes gomobile cmd tools and source -This image comes with gomobile checkedout and preinitialized (time and space consuming). In order to install this predone work from the image into your Drone CI workspace (a docker volume mounted to `/workspace`), you will want your first pipeline step to be: +This container has its own GOPATH with only gomobile in it, so to use, you'll need to re-get your go dependancies and then run `gomobile init`. The following example shows a Drone CI step using this image - go-link: - image: openpriv/android-go-mobile + gomobile-build: + image: openpriv/android-go-mobile:2021.03 commands: - - cp -as /go /workspace/go + - go mod download + - gomobile init + - make -`cp -as` recreates the directory structure from /go in /workspace/go but for each file, it just creates a symlink. This is the quickest and most efficent way to mirror the work supplied with the image into your workspace. From a4fefa5b5e6d2cb2afc829a9334ce62e8472b46c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 21:58:37 -0700 Subject: [PATCH 09/13] Version NDK and gomobile manually --- Dockerfile | 16 ++++++++++++++-- README.md | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a1103f3..b407d16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,9 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO "platform-tools" # Install NDK -RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" +ENV NDK_VER="17.2.4988734" +RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER" +RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle # Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile # Adapted from alpine apk to debian apt @@ -88,5 +90,15 @@ ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH" # install gomobile -RUN go get golang.org/x/mobile/cmd/gomobile +RUN cd /workspace/go/src; \ + mkdir -p golang.org/x; \ + cd golang.org/x; \ + git clone https://github.com/golang/mobile.git; \ + cd mobile; \ + git checkout 507816974b79c76a5fe70f9580265cd57dc78bbe; + +RUN go install golang.org/x/mobile/cmd/gomobile + +#RUN go get golang.org/x/mobile/cmd/gomobile@v0.0.0-20200629153529-33b80540585f + RUN gomobile init -ndk $ANDROID_HOME/ndk-bundle/ diff --git a/README.md b/README.md index b1b90eb..da1afea 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Versions are: - 2018.07 - Go 1.10.3 - Android API 28 + - NDK 17.2.4988734 ## Install and Use From aee5601f923b332ae02c756a94f2d7ce42422fe2 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 22:33:09 -0700 Subject: [PATCH 10/13] add 2021.03 ndk version to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index da1afea..119d166 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Versions are: - 2021.03 - Go 1.15.10 - Android API 29 + - NDK 21.0.6113669 - 2018.07 - Go 1.10.3 - Android API 28 From 662f10bde613d9f6794792752438d80cfe8742d1 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 22 Mar 2021 22:59:43 -0700 Subject: [PATCH 11/13] merge changes from 2018.07 including versioning gomobile --- Dockerfile | 24 ++++++++++++++++-------- README.md | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c91028..24c9e86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,9 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO "platform-tools" # Install NDK -RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle" -ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle +ENV NDK_VER="21.0.6113669" +RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER" +RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle # Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile # Adapted from alpine apk to debian apt @@ -35,8 +36,8 @@ ENV ANDROID_NDK_ROOT $ANDROID_HOME/ndk-bundle ## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf RUN echo 'hosts: files dns' > /etc/nsswitch.conf -ENV GOLANG_VERSION 1.15.10 -ENV GOLANG_SHA256 c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65 +ENV GOLANG_VERSION=1.15.10 +ENV GOLANG_SHA256=c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65 RUN set -eux; \ apt-get update; \ @@ -78,17 +79,24 @@ RUN set -eux; \ go version # persist new go in PATH -ENV PATH /usr/local/go/bin:$PATH +ENV PATH=/usr/local/go/bin:$PATH -ENV GOMOBILEPATH /gomobile +ENV GOMOBILEPATH=/gomobile # Setup /workspace RUN mkdir $GOMOBILEPATH # Set up GOPATH in /workspace -ENV GOPATH $GOMOBILEPATH -ENV PATH $GOMOBILEPATH/bin:$PATH +ENV GOPATH=$GOMOBILEPATH +ENV PATH=$GOMOBILEPATH/bin:$PATH RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH" # install gomobile +RUN cd $GOMOBILEPATH/src; \ + mkdir -p golang.org/x; \ + cd golang.org/x; \ + git clone https://github.com/golang/mobile.git; \ + cd mobile; \ + git checkout bdb1ca9a1e083af5929a8214e8a056d638ebbf2d; + RUN go get golang.org/x/mobile/cmd/gomobile RUN go get golang.org/x/mobile/cmd/gobind RUN go get golang.org/x/mobile/bind diff --git a/README.md b/README.md index 8db3dbf..53fcfa2 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,11 @@ Versions are: - 2021.03 - Go 1.15.10 - Android API 29 + - NDK 21.0.6113669 - 2018.07 - Go 1.10.3 - Android API 28 + - NDK 17.2.4988734 ## Install and Use @@ -31,3 +33,20 @@ This container has its own GOPATH with only gomobile in it, so to use, you'll ne - gomobile init - make +### Version 2018.07 + +This image includes: + +- Android SDK, NDK, tools, and API version 28 at `/usr/local/android-sdk` +- Go lang 1.10.3 at `/usr/local/go` +- $GOPATH set to `/workspace/go` +- A go directory with an initialized gomobile installed at `/go` + +This image comes with gomobile checkedout and preinitialized (time and space consuming). In order to install this predone work from the image into your Drone CI workspace (a docker volume mounted to `/workspace`), you will want your first pipeline step to be: + + go-link: + image: openpriv/android-go-mobile + commands: + - cp -as /go /workspace/go + +`cp -as` recreates the directory structure from /go in /workspace/go but for each file, it just creates a symlink. This is the quickest and most efficent way to mirror the work supplied with the image into your workspace. From 7997f18a4ea5c40ea542b4aa8df45e5acb0a0229 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 23 Mar 2021 11:33:36 -0700 Subject: [PATCH 12/13] README typo go version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 53fcfa2..a2a29b2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Versions are: This image includes: - Android SDK, NDK, tools, and API version 29 and Buildtools 30.0.2 at `/usr/local/android-sdk` -- Go lang 1.10.3 at `/usr/local/go` +- Go lang 1.15.10 at `/usr/local/go` - $GOPATH set to `/gomobile` - GOPATH includes gomobile cmd tools and source From 43db611a501fb9888626941fa803f94e6decb8aa Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 23 Mar 2021 11:51:00 -0700 Subject: [PATCH 13/13] update README md syntax --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2a29b2..3444a0a 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ This container has its own GOPATH with only gomobile in it, so to use, you'll ne image: openpriv/android-go-mobile:2021.03 commands: - go mod download - - gomobile init - - make + - gomobile init + - make ### Version 2018.07