Compare commits
10 Commits
761049ea6a
...
6da170e45a
Author | SHA1 | Date |
---|---|---|
Dan Ballard | 6da170e45a | |
Sarah Jamie Lewis | 906e633e4f | |
Sarah Jamie Lewis | 0ad842a642 | |
Sarah Jamie Lewis | 0efd4ae9a6 | |
Sarah Jamie Lewis | 6280a51b6e | |
Dan Ballard | 423e81de7d | |
Sarah Jamie Lewis | 224ce2663d | |
Dan Ballard | b55c0713cb | |
Dan Ballard | 43db611a50 | |
Dan Ballard | 7997f18a4e |
41
Dockerfile
41
Dockerfile
|
@ -6,7 +6,7 @@ FROM openjdk:8
|
||||||
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
|
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
|
||||||
ANDROID_HOME="/usr/local/android-sdk" \
|
ANDROID_HOME="/usr/local/android-sdk" \
|
||||||
ANDROID_SDK=$ANDROID_HOME \
|
ANDROID_SDK=$ANDROID_HOME \
|
||||||
ANDROID_VERSION=29 \
|
ANDROID_VERSION=31 \
|
||||||
ANDROID_BUILD_TOOLS_VERSION=30.0.2
|
ANDROID_BUILD_TOOLS_VERSION=30.0.2
|
||||||
|
|
||||||
## Download Android SDK
|
## Download Android SDK
|
||||||
|
@ -24,7 +24,7 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO
|
||||||
"platform-tools"
|
"platform-tools"
|
||||||
|
|
||||||
# Install NDK
|
# Install NDK
|
||||||
ENV NDK_VER="21.0.6113669"
|
ENV NDK_VER="22.1.7171670"
|
||||||
RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER"
|
RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER"
|
||||||
RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle
|
RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle
|
||||||
## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
|
## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
|
||||||
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
|
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
|
|
||||||
ENV GOLANG_VERSION=1.15.10
|
ENV GOLANG_VERSION=1.21.5.linux-amd64
|
||||||
ENV GOLANG_SHA256=c1dbca6e0910b41d61a95bf9878f6d6e93d15d884c226b91d9d4b1113c10dd65
|
ENV GOLANG_SHA256=e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e
|
||||||
|
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
@ -49,32 +49,11 @@ RUN set -eux; \
|
||||||
golang \
|
golang \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
export \
|
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.tar.gz"; \
|
||||||
## set GOROOT_BOOTSTRAP such that we can actually build Go
|
|
||||||
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
|
|
||||||
## ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
|
|
||||||
## (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
|
|
||||||
GOOS="$(go env GOOS)" \
|
|
||||||
GOARCH="$(go env GOARCH)" \
|
|
||||||
GOHOSTOS="$(go env GOHOSTOS)" \
|
|
||||||
GOHOSTARCH="$(go env GOHOSTARCH)" \
|
|
||||||
; \
|
|
||||||
## also explicitly set GO386 and GOARM if appropriate
|
|
||||||
## https://github.com/docker-library/golang/issues/184
|
|
||||||
aptArch="$(dpkg-architecture -q DEB_BUILD_GNU_CPU)"; \
|
|
||||||
case "$aptArch" in \
|
|
||||||
arm) export GOARM='6' ;; \
|
|
||||||
x86_64) export GO386='387' ;; \
|
|
||||||
esac; \
|
|
||||||
\
|
|
||||||
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
|
|
||||||
echo "$GOLANG_SHA256 *go.tgz" | sha256sum -c -; \
|
echo "$GOLANG_SHA256 *go.tgz" | sha256sum -c -; \
|
||||||
tar -C /usr/local -xzf go.tgz; \
|
tar -C /usr/local -xzf go.tgz; \
|
||||||
rm go.tgz; \
|
rm go.tgz; \
|
||||||
\
|
\
|
||||||
cd /usr/local/go/src; \
|
|
||||||
./make.bash; \
|
|
||||||
\
|
|
||||||
export PATH="/usr/local/go/bin:$PATH"; \
|
export PATH="/usr/local/go/bin:$PATH"; \
|
||||||
go version
|
go version
|
||||||
|
|
||||||
|
@ -89,16 +68,18 @@ ENV GOPATH=$GOMOBILEPATH
|
||||||
ENV PATH=$GOMOBILEPATH/bin:$PATH
|
ENV PATH=$GOMOBILEPATH/bin:$PATH
|
||||||
RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH"
|
RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH"
|
||||||
|
|
||||||
|
# 2022.11.09
|
||||||
|
ENV GOMOBILEHASH=43a0384520996c8376bfb8637390f12b44773e65
|
||||||
|
|
||||||
# install gomobile
|
# install gomobile
|
||||||
RUN cd $GOMOBILEPATH/src; \
|
RUN cd $GOMOBILEPATH/src; \
|
||||||
mkdir -p golang.org/x; \
|
mkdir -p golang.org/x; \
|
||||||
cd golang.org/x; \
|
cd golang.org/x; \
|
||||||
git clone https://github.com/golang/mobile.git; \
|
git clone https://github.com/golang/mobile.git; \
|
||||||
cd mobile; \
|
cd mobile; \
|
||||||
git checkout bdb1ca9a1e083af5929a8214e8a056d638ebbf2d;
|
git checkout $GOMOBILEHASH;
|
||||||
|
|
||||||
RUN go get golang.org/x/mobile/cmd/gomobile
|
RUN go install golang.org/x/mobile/cmd/gomobile@$GOMOBILEHASH
|
||||||
RUN go get golang.org/x/mobile/cmd/gobind
|
RUN go install golang.org/x/mobile/cmd/gobind@$GOMOBILEHASH
|
||||||
RUN go get golang.org/x/mobile/bind
|
|
||||||
|
|
||||||
RUN gomobile clean
|
RUN gomobile clean
|
||||||
|
|
20
README.md
20
README.md
|
@ -1,9 +1,23 @@
|
||||||
# Android, Go, and gomobile
|
# Android, Go, and gomobile
|
||||||
|
|
||||||
|
Dockerfiles @ [git.openprivacy.ca/openprivacy/android-go-mobile](https://git.openprivacy.ca/openprivacy/android-go-mobile)
|
||||||
|
|
||||||
This image was built for use with Drone CI but can be used with any docker setup you want.
|
This image was built for use with Drone CI but can be used with any docker setup you want.
|
||||||
|
|
||||||
Versions are:
|
Versions are:
|
||||||
|
|
||||||
|
- 2024.01
|
||||||
|
- Go 1.21.5
|
||||||
|
- Android API 31
|
||||||
|
- NDK 21.0.6113669
|
||||||
|
- 2022.11
|
||||||
|
- Go 1.19.3
|
||||||
|
- Android API 31
|
||||||
|
- NDK 21.0.6113669
|
||||||
|
- 2021.03
|
||||||
|
- Go 1.17.5
|
||||||
|
- Android API 30
|
||||||
|
- NDK 21.0.6113669
|
||||||
- 2021.03
|
- 2021.03
|
||||||
- Go 1.15.10
|
- Go 1.15.10
|
||||||
- Android API 29
|
- Android API 29
|
||||||
|
@ -20,7 +34,7 @@ Versions are:
|
||||||
This image includes:
|
This image includes:
|
||||||
|
|
||||||
- Android SDK, NDK, tools, and API version 29 and Buildtools 30.0.2 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`
|
- Go lang 1.15.10 at `/usr/local/go`
|
||||||
- $GOPATH set to `/gomobile`
|
- $GOPATH set to `/gomobile`
|
||||||
- GOPATH includes gomobile cmd tools and source
|
- GOPATH includes gomobile cmd tools and source
|
||||||
|
|
||||||
|
@ -30,8 +44,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
|
image: openpriv/android-go-mobile:2021.03
|
||||||
commands:
|
commands:
|
||||||
- go mod download
|
- go mod download
|
||||||
- gomobile init
|
- gomobile init
|
||||||
- make
|
- make
|
||||||
|
|
||||||
### Version 2018.07
|
### Version 2018.07
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue