-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun
executable file
·26 lines (23 loc) · 1005 Bytes
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -eu
PLATFORM_FOLDER=.$(grep -oP 'idea.paths.selector=\K[\w\.\d]+' "$HOME"/android/android-studio/bin/studio.sh)
# 1. Use user 0 (root) to be able to access /dev/kvm.
# 2. The Android SDK download location is default in
# /root/Android/Sdk when we use the root user.
# 3. The container would fail to launch if we change
# the $HOME to not point to /headless. But the "adbkey"
# and "adbkey.pub" is created under "$HOME"/.android/
# by default. Thus, we have to map dir ".android" under
# /headless.
docker run --rm \
--privileged \
--user 0 \
-v "$HOME"/android/android-studio:/root/android-studio \
-v "$HOME"/android/"$PLATFORM_FOLDER":/root/"$PLATFORM_FOLDER" \
-v "$HOME"/android/Android:/root/Android \
-v "$HOME"/android/.gradle:/root/.gradle \
-v "$HOME"/android/.android:/headless/.android \
-v "$HOME"/AndroidStudioProjects:/root/AndroidStudioProjects \
-p 5901:5901 \
-p 6901:6901 \
ljishen/vnc-android-studio