Dockerfile,Makefile: add dockershell Makefile target for Docker builds

Fixes tailscale/tailscale#424

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/2/head
Elias Naur 4 years ago
parent 24e887bf48
commit 4ca298d19a

@ -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

@ -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

@ -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

@ -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)
Loading…
Cancel
Save