From 4ca298d19ac0fc19c07f55e9c6bf8b666a173193 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 8 Jun 2020 20:58:14 +0200 Subject: [PATCH] Dockerfile,Makefile: add dockershell Makefile target for Docker builds Fixes tailscale/tailscale#424 Signed-off-by: Elias Naur --- Dockerfile | 12 ++++++------ Makefile | 6 +++++- README.md | 8 ++++++++ build.sh | 10 ---------- 4 files changed, 19 insertions(+), 17 deletions(-) delete mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index 385af78..8382e74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# This is the start of a Dockerfile to build tailscale-android. -# It works, but it's not very efficient yet; see TODOs below. +# This is a Dockerfile for creating a build environment for +# tailscale-android. FROM openjdk:8-jdk @@ -10,6 +10,8 @@ RUN apt-get install -y lib32z1 lib32stdc++6 RUN apt-get -y --no-install-recommends install curl gcc RUN apt-get -y --no-install-recommends install ca-certificates libc6-dev git +RUN apt-get -y install make + RUN mkdir -p BUILD ENV HOME /build @@ -35,7 +37,7 @@ RUN curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.ta RUN echo "1c39eac4ae95781b066c144c58e45d6859652247f7515f0d2cba7be7d57d2226 go${GO_VERSION}.linux-amd64.tar.gz" | sha256sum -c RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz && mv go goroot ENV GOROOT $HOME/goroot -ENV PATH $PATH:$GOROOT/bin:$HOME/bin +ENV PATH $PATH:$GOROOT/bin:$HOME/bin:$ANDROID_HOME/platform-tools RUN mkdir -p $HOME/tailscale-android WORKDIR $HOME/tailscale-android @@ -49,6 +51,4 @@ COPY android/gradlew android/gradlew COPY android/gradle android/gradle RUN ./android/gradlew -ADD . . -RUN ./build.sh - +CMD /bin/bash diff --git a/Makefile b/Makefile index c8b92fe..c531506 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,11 @@ release: $(RELEASE_AAB) install: $(DEBUG_APK) adb install -r $(DEBUG_APK) +dockershell: + docker build -t tailscale-android . + docker run -v $(CURDIR):/build/tailscale-android -it --rm tailscale-android + clean: rm -rf android/build $(RELEASE_AAB) $(DEBUG_APK) $(AAR) -.PHONY: all clean install aar release +.PHONY: all clean install aar release dockershell diff --git a/README.md b/README.md index 3be4972..090a828 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ $ make tailscale-debug.apk $ adb install -r tailscale-debug.apk ``` +The `dockershell` target builds a container with the necessary +dependencies and runs a shell inside it. + +``` +$ make dockershell +# make tailscale-debug.apk +``` + We only guarantee to support the latest Go release and any Go beta or release candidate builds (currently Go 1.14) in module mode. It might work in earlier Go versions or in GOPATH mode, but we're making no diff --git a/build.sh b/build.sh deleted file mode 100755 index 26382cd..0000000 --- a/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -set -e - -mkdir -p android/libs -go run gioui.org/cmd/gogio -buildmode archive -target android -appid com.tailscale.ipn -o android/libs/ipn.aar tailscale.com/tailscale-android/cmd/tailscale -(cd android && ./gradlew assembleDebug)