Add Makefile
This commit is contained in:
@@ -32,17 +32,17 @@ RUN dpkg --add-architecture i386 && \
|
||||
|
||||
# Customized steps per specific platform
|
||||
yes | sdkmanager --no_https --licenses && \
|
||||
sdkmanager --no_https emulator tools platform-tools "platforms;{{ .Env.PLATFORM }}" "system-images;{{ .Env.PLATFORM }};google_apis;x86" --verbose && \
|
||||
echo no | avdmanager create avd -n "x86" --package "system-images;{{ .Env.PLATFORM }};google_apis;x86" --tag google_apis && \
|
||||
sdkmanager --no_https emulator tools platform-tools "platforms;{{ platform }}" "system-images;{{ platform }};google_apis;x86" --verbose && \
|
||||
echo no | avdmanager create avd -n "x86" --package "system-images;{{ platform }};google_apis;x86" --tag google_apis && \
|
||||
# Unfilter devices (now local because CI downloads from github are unstable)
|
||||
# curl -o /root/.android/adb_usb.ini https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini && \
|
||||
|
||||
# Optimize size of the image
|
||||
rm /root/.android/avd/x86.avd/userdata.img && \
|
||||
tar -czvf /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/userdata.img.tar.gz /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/userdata.img && \
|
||||
rm /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/userdata.img && \
|
||||
tar -czvf /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/system.img.tar.gz /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/system.img && \
|
||||
rm /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/system.img && \
|
||||
tar -czvf /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/userdata.img.tar.gz /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/userdata.img && \
|
||||
rm /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/userdata.img && \
|
||||
tar -czvf /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/system.img.tar.gz /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/system.img && \
|
||||
rm /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/system.img && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get purge -yq unzip openjdk-8-jdk && \
|
||||
|
||||
apt-get -yq autoremove && \
|
||||
|
||||
29
templates/Makefile
Normal file
29
templates/Makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
OWNER=agoda
|
||||
IMAGE_NAME=docker-emulator-{{ platform }}
|
||||
VCS_REF=`git rev-parse --short HEAD`
|
||||
IMAGE_VERSION=1.0.$(TRAVIS_BUILD_NUMBER)
|
||||
QNAME=$(OWNER)/$(IMAGE_NAME)
|
||||
|
||||
GIT_TAG=$(QNAME):$(VCS_REF)
|
||||
BUILD_TAG=$(QNAME):$(IMAGE_VERSION)
|
||||
LATEST_TAG=$(QNAME):latest
|
||||
|
||||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
build:
|
||||
docker build \
|
||||
--build-arg VCS_REF=$(VCS_REF) \
|
||||
--build-arg IMAGE_VERSION=$(IMAGE_VERSION) \
|
||||
-t $(GIT_TAG) $(ROOT_DIR)
|
||||
|
||||
lint:
|
||||
docker run -it --rm -v "$(ROOT_DIR)/Dockerfile:/Dockerfile:ro" redcoolbeans/dockerlint
|
||||
|
||||
tag:
|
||||
docker tag $(GIT_TAG) $(BUILD_TAG)
|
||||
docker tag $(GIT_TAG) $(LATEST_TAG)
|
||||
|
||||
push:
|
||||
docker push $(GIT_TAG)
|
||||
docker push $(BUILD_TAG)
|
||||
docker push $(LATEST_TAG)
|
||||
@@ -26,7 +26,7 @@ hw.ramSize=1536
|
||||
hw.sensors.orientation=yes
|
||||
hw.sensors.proximity=yes
|
||||
hw.trackBall=no
|
||||
image.sysdir.1=system-images/{{ .Env.PLATFORM }}/google_apis/x86/
|
||||
image.sysdir.1=system-images/{{ platform }}/google_apis/x86/
|
||||
runtime.network.latency=none
|
||||
runtime.network.speed=full
|
||||
showDeviceFrame=no
|
||||
|
||||
@@ -36,8 +36,8 @@ x11vnc -display :1 -nopw -forever &
|
||||
# qemu references bios by relative path
|
||||
cd /opt/android-sdk-linux/emulator
|
||||
|
||||
tar -xvf /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/userdata.img.tar.gz --directory /
|
||||
tar -xvf /opt/android-sdk-linux/system-images/{{ .Env.PLATFORM }}/google_apis/x86/system.img.tar.gz --directory /
|
||||
tar -xvf /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/userdata.img.tar.gz --directory /
|
||||
tar -xvf /opt/android-sdk-linux/system-images/{{ platform }}/google_apis/x86/system.img.tar.gz --directory /
|
||||
|
||||
CONFIG="/root/.android/avd/x86.avd/config.ini"
|
||||
CONFIGTMP=${CONFIG}.tmp
|
||||
|
||||
Reference in New Issue
Block a user