-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
env/android-amd64-emu: add new Android emulator container + VM image
Now that we can do nested virtualization on GCE, that means we can run the Android emulator (which requires KVM) on GCE and at least get fast trybots and such for android-amd64. Updates golang/go#23824 Change-Id: I0da38c7fa0f15492230a31291d2921ba72f2151d Reviewed-on: https://go-review.googlesource.com/c/163738 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- Loading branch information
Showing
11 changed files
with
325 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM golang:1.11 | ||
LABEL maintainer "golang-dev@googlegroups.com" | ||
|
||
ENV CGO_ENABLED=0 | ||
|
||
# BEGIN deps (run `make update-deps` to update) | ||
|
||
# Repo cloud.google.com/go at 5c31045 (2018-05-08) | ||
ENV REV=5c31045bc3f4855c97f997a1940dfefc1598aa2d | ||
RUN go get -d cloud.google.com/go/compute/metadata &&\ | ||
(cd /go/src/cloud.google.com/go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV) | ||
|
||
# Repo golang.org/x/net at d11bb6c (2018-05-07) | ||
ENV REV=d11bb6cd8e3c4e60239c9cb20ef68586d74500d0 | ||
RUN go get -d golang.org/x/net/context `#and 2 other pkgs` &&\ | ||
(cd /go/src/golang.org/x/net && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV) | ||
|
||
# Optimization to speed up iterative development, not necessary for correctness: | ||
RUN go install cloud.google.com/go/compute/metadata \ | ||
golang.org/x/net/context \ | ||
golang.org/x/net/context/ctxhttp | ||
# END deps. | ||
|
||
COPY . /go/src/golang.org/x/build/ | ||
|
||
# Install static binary to /go/bin/stage0 | ||
RUN go install golang.org/x/build/cmd/buildlet/stage0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Copyright 2019 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM golang/buildlet-stage0 AS stage0 | ||
|
||
FROM debian:buster | ||
MAINTAINER golang-dev <golang-dev@googlegroups.com> | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
ENV GO_BUILDER_ENV android-amd64-emu | ||
ENV PATH="${PATH}:/android/sdk/platform-tools" | ||
ENV CC_FOR_android_386=/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-clang | ||
ENV CC_FOR_android_amd64=/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang | ||
|
||
# gdb: optionally used by runtime tests for gdb | ||
# strace: optionally used by some net/http tests | ||
# gcc libc6-dev: for building Go's bootstrap 'dist' prog | ||
# libc6-dev-i386 gcc-multilib: for 32-bit builds | ||
# procps lsof psmisc: misc basic tools | ||
# libgles2-mesa-dev libopenal-dev fonts-noto: required by x/mobile repo | ||
# unzip openjdk-8-jdk python lib32z1: required by the Android SDK | ||
RUN apt-get update && apt-get install -y \ | ||
--no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
gdb \ | ||
strace \ | ||
gcc \ | ||
libc6-dev \ | ||
libc6-dev-i386 \ | ||
gcc-multilib \ | ||
procps \ | ||
lsof \ | ||
psmisc \ | ||
libgles2-mesa-dev \ | ||
libopenal-dev \ | ||
fonts-noto \ | ||
fonts-noto-mono \ | ||
openssh-server \ | ||
unzip \ | ||
openjdk-8-jdk \ | ||
python \ | ||
lib32z1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p /go1.4-amd64 \ | ||
&& ( \ | ||
curl --silent https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz | tar -C /go1.4-amd64 -zxv \ | ||
) \ | ||
&& mv /go1.4-amd64/go /go1.4 \ | ||
&& rm -rf /go1.4-amd64 \ | ||
&& rm -rf /go1.4/pkg/linux_amd64_race \ | ||
/go1.4/api \ | ||
/go1.4/blog \ | ||
/go1.4/doc \ | ||
/go1.4/misc \ | ||
/go1.4/test \ | ||
&& find /go1.4 -type d -name testdata | xargs rm -rf | ||
RUN mkdir -p /android/sdk \ | ||
&& curl -o /android/sdk/sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip \ | ||
&& unzip -d /android/sdk /android/sdk/sdk-tools-linux.zip \ | ||
&& rm -rf /android/sdk/sdk-tools-linux.zip | ||
|
||
RUN yes | /android/sdk/tools/bin/sdkmanager --licenses \ | ||
&& /android/sdk/tools/bin/sdkmanager ndk-bundle "system-images;android-26;default;x86_64" \ | ||
&& /android/sdk/tools/bin/sdkmanager "build-tools;21.1.2" "platforms;android-26" \ | ||
&& /android/sdk/tools/bin/sdkmanager --update | ||
|
||
# Gradle for gomobile | ||
RUN curl -L -o /android/gradle-5.2.1-bin.zip https://services.gradle.org/distributions/gradle-5.2.1-bin.zip \ | ||
&& unzip -d /android /android/gradle-5.2.1-bin.zip \ | ||
&& rm /android/gradle-5.2.1-bin.zip | ||
|
||
# Create emulator | ||
RUN echo no | /android/sdk/tools/bin/avdmanager create avd --force --name android-avd --package "system-images;android-26;default;x86_64" | ||
|
||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0 | ||
|
||
CMD ["/usr/local/bin/stage0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2018 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
IMAGE_NAME=$(shell basename $(CURDIR)) | ||
|
||
usage: | ||
echo "see Makefile for usage for building $(IMAGE_NAME)" | ||
|
||
docker: Dockerfile | ||
go install golang.org/x/build/cmd/xb | ||
xb docker build -t golang/$(IMAGE_NAME) . | ||
|
||
push-staging: docker | ||
go install golang.org/x/build/cmd/xb | ||
$(eval REV := $(shell docker images --format={{.ID}} golang/android-amd64-emu:latest)) | ||
xb --staging docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):$(REV) | ||
xb --staging docker push REPO/$(IMAGE_NAME):$(REV) | ||
|
||
push-prod: docker | ||
go install golang.org/x/build/cmd/xb | ||
$(eval REV := $(shell docker images --format={{.ID}} golang/android-amd64-emu:latest)) | ||
xb --prod docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):$(REV) | ||
xb --prod docker push REPO/$(IMAGE_NAME):$(REV) | ||
|
||
vm-prod: push-prod | ||
./create-vm.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
The android-amd64-emu builder is built in two parts: | ||
|
||
* first, a large Docker container | ||
* second, a VMX+konlet-based VM image with that Docker image pre-pulled | ||
|
||
|
Oops, something went wrong.