├── .dockerignore ├── .gitignore ├── Dockerfile ├── LICENSE ├── NOTICE ├── Readme.md ├── build.sh ├── compose.yml ├── provisioning ├── 51-android.rules ├── docker_entrypoint.sh └── ndkTests.sh ├── run.sh └── utils ├── clean_docker.sh └── docker_attach_latest.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | studio-data 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | studio-data/* 2 | !studio-data/profile 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | LABEL Simon Egli 4 | 5 | ARG USER=android 6 | 7 | RUN dpkg --add-architecture i386 8 | RUN apt-get update && apt-get install -y \ 9 | build-essential git neovim wget unzip sudo \ 10 | libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 \ 11 | libxrender1 libxtst6 libxi6 libfreetype6 libxft2 xz-utils vim\ 12 | qemu qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils libnotify4 libglu1 libqt5widgets5 openjdk-8-jdk openjdk-11-jdk xvfb \ 13 | && \ 14 | apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 15 | 16 | RUN groupadd -g 1000 -r $USER 17 | RUN useradd -u 1000 -g 1000 --create-home -r $USER 18 | RUN adduser $USER libvirt 19 | RUN adduser $USER kvm 20 | #Change password 21 | RUN echo "$USER:$USER" | chpasswd 22 | #Make sudo passwordless 23 | RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-$USER 24 | RUN usermod -aG sudo $USER 25 | RUN usermod -aG plugdev $USER 26 | RUN mkdir -p /androidstudio-data 27 | VOLUME /androidstudio-data 28 | RUN chown $USER:$USER /androidstudio-data 29 | 30 | RUN mkdir -p /studio-data/Android/Sdk && \ 31 | chown -R $USER:$USER /studio-data/Android 32 | 33 | 34 | RUN mkdir -p /studio-data/profile/android && \ 35 | chown -R $USER:$USER /studio-data/profile 36 | 37 | COPY provisioning/docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh 38 | COPY provisioning/ndkTests.sh /usr/local/bin/ndkTests.sh 39 | RUN chmod +x /usr/local/bin/* 40 | COPY provisioning/51-android.rules /etc/udev/rules.d/51-android.rules 41 | 42 | USER $USER 43 | 44 | WORKDIR /home/$USER 45 | 46 | #Install Flutter 47 | ARG FLUTTER_URL=https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.13.6-stable.tar.xz 48 | ARG FLUTTER_VERSION=3.13.6 49 | 50 | RUN wget "$FLUTTER_URL" -O flutter.tar.xz 51 | RUN tar -xvf flutter.tar.xz 52 | RUN rm flutter.tar.xz 53 | 54 | #Android Studio 55 | ARG ANDROID_STUDIO_URL=https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2022.3.1.20/android-studio-2022.3.1.20-linux.tar.gz 56 | ARG ANDROID_STUDIO_VERSION=2022.3.1.20 57 | 58 | RUN wget "$ANDROID_STUDIO_URL" -O android-studio.tar.gz 59 | RUN tar xzvf android-studio.tar.gz 60 | RUN rm android-studio.tar.gz 61 | 62 | RUN ln -s /studio-data/profile/AndroidStudio$ANDROID_STUDIO_VERSION .AndroidStudio$ANDROID_STUDIO_VERSION 63 | RUN ln -s /studio-data/Android Android 64 | RUN ln -s /studio-data/profile/android .android 65 | RUN ln -s /studio-data/profile/java .java 66 | RUN ln -s /studio-data/profile/gradle .gradle 67 | ENV ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 68 | 69 | WORKDIR /home/$USER 70 | 71 | ENTRYPOINT [ "/usr/local/bin/docker_entrypoint.sh" ] 72 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2017 Simon Egli 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Deadolus Android-Studio-Docker 2 | Copyright 2017 Simon Egli 3 | 4 | This product involves code developed at [u-blox](https://www.u-blox.com). 5 | 6 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Android-Studio docker container 2 | ============ 3 | Complete Android-Studio in a Docker container. 4 | You can even start an Emulator inside it. 5 | 6 | If you don't have a display the Emulator can run with a "dummy" display - perfect for continous integration. 7 | 8 | Tested on Linux only. 9 | 10 | Building without docker compose 11 | ------------- 12 | Just run "./build.sh", or "docker build -t deadolus/android-studio ." directly. 13 | An already built version is also on Docker Hub. So you may also run "docker pull deadolus/android-studio". 14 | You may of course change the name of the container. 15 | 16 | Running without docker compose 17 | ------------- 18 | Run 19 | 20 | "HOST_DISPLAY=1 ./run.sh" 21 | 22 | or run directly via 23 | 24 | "docker run -i $AOSP_ARGS -v `pwd`/studio-data:/studio-data --privileged --group-add plugdev deadolus/android-studio" 25 | 26 | 27 | run.sh has some options which you can set via Environment variables. 28 | 29 | * NO_TTY - Do not run docker with -t flag 30 | * DOCKERHOSTNAME - set Docker Hostname. I use it to run tests headless 31 | * HOST_USB - Use the USB of the Host (useful if you want your physical device to be recognized by adb inside the container) 32 | * HOST_NET - Use the network of the host 33 | * HOST_DISPLAY - Allow the container to use the Display of the host. E.g. Let the emulator run on the Hosts Display environment. 34 | 35 | You may use a Variable like this: "HOST_NET=1 ./run.sh" 36 | 37 | The default docker entrypoint tries to start android-studio. 38 | So it probably does not make sense to try starting via run.sh without 39 | HOST_DISPLAY=1. 40 | If you just want a shell in the container, without starting Android Studio, run "./run.sh bash" to bypass starting Android Studio 41 | 42 | Running and Building with docker compose: 43 | ------------- 44 | 45 | 1. Comment/uncomment the appropriate lines in the compose.yaml depending on if you are running this natively in linux or in WSL. 46 | 2. To build: `docker compose build android_emulator` 47 | 3. To run: `docker compose run android_emulator` 48 | 49 | 50 | 51 | Additional information - continous integration 52 | ------------- 53 | I included a script under provisioning/ndkTests.sh which demonstrates how you may use this container in a CI environment. 54 | The script starts a headless container, if the HOSTNAME variable is set to CI. 55 | It then changes in to a directory (workspace/GoogleTestApp) where it builds and installs an app. 56 | It parses logcat for lines containing a string (GoogleTest), uninstalls the app and does some analysis on the parsed lines. 57 | While this script probably does not make much sense FOR YOU, it might be useful as a guiding point for you. 58 | 59 | Contributors 60 | ------------ 61 | [@Deadolus](https://github.com/Deadolus) 62 | [@guilhermelinhares](https://github.com/guilhermelinhares) 63 | [@mtomcanyi](https://github.com/mtomcanyi) 64 | [@Naveenkhegde](https://github.com/Naveenkhegde) 65 | [@BenBlumer](https://github.com/BenBlumer) 66 | 67 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | mkdir -p studio-data/profile/AndroidStudio2022.3.1.20 || exit 2 | mkdir -p studio-data/Android || exit 3 | mkdir -p studio-data/profile/.android || exit 4 | mkdir -p studio-data/profile/.java || exit 5 | mkdir -p studio-data/profile/.gradle || exit 6 | docker build -t deadolus/android-studio . || exit 7 | -------------------------------------------------------------------------------- /compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | android_emulator: 5 | image: deadolus/android-studio 6 | build: . 7 | volumes: 8 | - ./studio-data/profile/AndroidStudio2022.3.1.20:/studio-data/profile/AndroidStudio2022.3.1.20 9 | - ./studio-data/Android:/studio-data/Android 10 | - ./studio-data/profile/.android:/studio-data/profile/.android 11 | - ./studio-data/profile/.java:/studio-data/profile/.java 12 | - ./studio-data/profile/.gradle:/studio-data/profile/.gradle 13 | # Mount the proper location for X11 server if you are running this in WSL 14 | - /mnt/wslg/.X11-unix:/tmp/.X11-unix 15 | # Mount the proper locationm for x11 server if you are running this in native linux 16 | # - /tmp/.X11-unix:/tmp/.X11-unix . 17 | - android_studio:/androidstudio-data 18 | environment: 19 | - DISPLAY=:0 # Set DISPLAY environment variable 20 | privileged: true 21 | group_add: 22 | - plugdev 23 | network_mode: "host" 24 | # devices: 25 | # Uncomment the previous and next line if you want to pass through USB to the container. 26 | # - /dev/bus/usb:/dev/bus/usb 27 | entrypoint: /usr/local/bin/docker_entrypoint.sh 28 | volumes: 29 | android_studio: 30 | -------------------------------------------------------------------------------- /provisioning/51-android.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0660", 2 | GROUP="plugdev", SYMLINK+="android%n" 3 | -------------------------------------------------------------------------------- /provisioning/docker_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Change permissions of /dev/kvm for Android Emulator 4 | echo "`whoami`" | sudo -S chmod 777 /dev/kvm > /dev/null 2>&1 5 | 6 | export PATH=$PATH:/studio-data/platform-tools/ 7 | 8 | # Ensure the Android directory exists and has the correct permissions 9 | if [ ! -d "/studio-data/Android" ]; then 10 | mkdir -p /studio-data/Android 11 | fi 12 | sudo chown -R android:android /studio-data/Android 13 | 14 | # Default to 'bash' if no arguments are provided 15 | args="$@" 16 | if [ -z "$args" ]; then 17 | args="~/android-studio/bin/studio.sh" 18 | fi 19 | 20 | exec $args 21 | -------------------------------------------------------------------------------- /provisioning/ndkTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This sript will install our Google Tests on an Android device. 3 | # If needed the script will start an Emulator beforehand. 4 | #It will then run those tests and analyze the results. 5 | #Will return 0 if everything succeeded. 6 | #If there were failed tests it will return the number of failed tests 7 | 8 | #Ensure server is started 9 | ADB="/studio-data/Android/Sdk/platform-tools/adb" 10 | "$ADB" start-server || exit 1 11 | 12 | if [ "$("$ADB" devices | grep device | wc -l)" -lt 2 ] ; then 13 | echo "No device found - starting Emulator" 14 | if [ "$HOSTNAME" = "CI" ]; then 15 | #Start a virtual framebuffer for continous integration, as we do not have a Display attached 16 | echo "Starting xvfb for CI..." 17 | Xvfb :1 & 18 | export DISPLAY=:1 19 | #Does not seem to work with GPU, so turn gpu processing off (slower) 20 | /studio-data/emulator/emulator -avd Nexus_5_API_24 -gpu off > android_emulator_log.txt 2>&1 & 21 | else 22 | /studio-data/emulator/emulator -avd Nexus_5_API_24 > android_emulator_log.txt 2>&1 & 23 | fi 24 | #/studio-data/emulator/emulator -avd Android_O & 25 | echo "Will now wait for the Emulator" 26 | #/studio-data/platform-tools/adb wait-for-device -s `/studio-data/platform-tools/adb devices | grep emulator` 27 | while (! "$ADB" devices | grep emulator | grep device > /dev/null); do sleep 1; echo -n "."; done 28 | fi 29 | device=$("ADB" devices | grep -Po ".*(?= *device$)" | head -n1) 30 | if [ "$device" = "" ]; then 31 | echo "Error in acquiring device, exiting..." 32 | exit 1 33 | fi 34 | echo "Found a device \"$device\" to use" 35 | 36 | #Install our tests 37 | pushd /studio-data/workspace/GoogleTestApp/ 38 | #Build and install our app(s) 39 | ./gradlew installDebug || exit 1 40 | #clean, assembleDebug, generateDebugSources 41 | popd 42 | #Clear old logcat data 43 | "$ADB" -s $device logcat -c || exit 1 44 | #(Force-)Start our tests 45 | "$ADB" -s $device shell am start -S -n com.example.company.testApp/com.example.company.testApp.MainActivity 46 | 47 | #Wait for the latest adb log data to arrive 48 | while [ $("$ADB" -s $device logcat -d -s "GoogleTest" | grep "End Result" | wc -l) -lt 2 ] ; do 49 | sleep 0.5 50 | done 51 | 52 | #Get our data from logcat and save it 53 | "$ADB" -s $device logcat -d -s "GoogleTest" > test_results.txt || exit 1 54 | 55 | #Uninstall our Tests again 56 | pushd /studio-data/workspace/GoogleTestAndroidGnssHal/ 57 | ./gradlew uninstallDebug || exit 1 58 | popd 59 | 60 | #Filter out the failed tests from the log file we pulled 61 | failed_tests=`cat test_results.txt | grep -P -o '\d+(?= Test\(s\) failed --> .*Failed)' | awk 'BEGIN {t=0} {t+=$1} END { print t}'` 62 | if [ "$failed_tests" -gt 0 ]; then 63 | echo "$failed_tests tests failed" 64 | else 65 | echo "All tests passed" 66 | exit 0 67 | fi 68 | 69 | "$ADB" -s $device emu kill 70 | while ("$ADB" devices | grep $device > /dev/null) ; do 71 | sleep 0.5 72 | done 73 | 74 | 75 | exit $failed_tests 76 | 77 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | ANDROID_GNSS_PATH_DEFAULT="/home/embuser/aosp-docker/_gnss_hal/" 2 | ANDROID_GNSS_PATH=${ANDROID_GNSS_PATH:-$ANDROID_GNSS_PATH_DEFAULT} 3 | AOSP_ARGS="" 4 | if [ "$NO_TTY" = "" ]; then 5 | AOSP_ARGS="${AOSP_ARGS} -t" 6 | fi 7 | if [ "$DOCKERHOSTNAME" != "" ]; then 8 | AOSP_ARGS="${AOSP_ARGS} -h $DOCKERHOSTNAME" 9 | fi 10 | if [ "$HOST_USB" != "" ]; then 11 | AOSP_ARGS="${AOSP_ARGS} -v /dev/bus/usb:/dev/bus/usb" 12 | fi 13 | if [ "$HOST_NET" != "" ]; then 14 | AOSP_ARGS="${AOSP_ARGS} --net=host" 15 | fi 16 | if [ "$HOST_DISPLAY" != "" ]; then 17 | AOSP_ARGS="${AOSP_ARGS} --env=DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix" 18 | fi 19 | 20 | #Make sure prerequisite directories exist in studio-data dir 21 | mkdir -p studio-data/profile/AndroidStudio2022.3.1.20 22 | mkdir -p studio-data/profile/android 23 | mkdir -p studio-data/profile/gradle 24 | mkdir -p studio-data/profile/java 25 | docker volume create --name=android_studio 26 | docker run -i $AOSP_ARGS -v `pwd`/studio-data:/studio-data -v android_studio:/androidstudio-data --privileged --group-add plugdev deadolus/android-studio $@ 27 | -------------------------------------------------------------------------------- /utils/clean_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker volume rm $(docker volume ls -qf dangling=true) 3 | docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 4 | docker rm $(docker ps -qa --no-trunc --filter "status=exited") 5 | -------------------------------------------------------------------------------- /utils/docker_attach_latest.sh: -------------------------------------------------------------------------------- 1 | docker exec -it `docker ps | grep android-studio | awk 'BEGIN{FS=" "}{print $NF}'` bash 2 | --------------------------------------------------------------------------------