Last active
April 30, 2025 12:24
-
-
Save devbathani/078a9e9a21422d8c24b5f105710df3a9 to your computer and use it in GitHub Desktop.
Flutter, Android and Emulator Docter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM cirrusci/flutter:latest | |
# Install required packages | |
RUN apt-get update && apt-get install -y \ | |
unzip wget tar qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils \ | |
libgl1-mesa-dev libpulse0 libglu1-mesa x11-utils | |
# Set environment variables | |
ENV ANDROID_HOME /opt/android-sdk | |
ENV PATH ${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin | |
# Download and install Android SDK Command Line Tools | |
RUN mkdir -p $ANDROID_HOME/cmdline-tools && \ | |
cd $ANDROID_HOME/cmdline-tools && \ | |
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip && \ | |
unzip cmdline-tools.zip && \ | |
mv cmdline-tools latest && \ | |
rm cmdline-tools.zip | |
# Accept licenses and install SDK components | |
RUN yes | sdkmanager --licenses | |
RUN sdkmanager "platform-tools" "platforms;android-33" "emulator" "system-images;android-33;google_apis;x86_64" | |
# Create AVD | |
RUN echo "no" | avdmanager create avd -n test_avd -k "system-images;android-33;google_apis;x86_64" --device "pixel" | |
# Enable KVM permissions | |
RUN mkdir -p ~/.android && echo 'hw.audioInput=no\nhw.keyboard=yes\nshowDeviceFrame=no\nskin.dynamic=no' >> ~/.android/advancedFeatures.ini | |
# Expose emulator ports | |
EXPOSE 5554 5555 | |
# Start emulator and run bash | |
CMD emulator -avd test_avd -no-audio -no-window -no-boot-anim -gpu swiftshader_indirect & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[supervisord] | |
nodaemon=true | |
logfile=/var/log/supervisor/supervisord.log | |
childlogdir=/var/log/supervisor | |
[program:xvfb] | |
command=/usr/bin/Xvfb :0 -screen 0 1280x800x24 | |
autorestart=true | |
stdout_logfile=/var/log/supervisor/xvfb.log | |
stderr_logfile=/var/log/supervisor/xvfb.err | |
[program:x11vnc] | |
command=/usr/bin/x11vnc -display :0 -nopw -forever -shared | |
autorestart=true | |
stdout_logfile=/var/log/supervisor/x11vnc.log | |
stderr_logfile=/var/log/supervisor/x11vnc.err | |
[program:novnc] | |
command=/usr/share/novnc/utils/novnc_proxy --vnc localhost:5900 --listen 6080 | |
autorestart=true | |
stdout_logfile=/var/log/supervisor/novnc.log | |
stderr_logfile=/var/log/supervisor/novnc.err | |
[program:emulator] | |
command=emulator -avd flutter_emulator -no-audio -no-boot-anim -no-window -gpu swiftshader_indirect -memory 2048 | |
environment=DISPLAY=":0" | |
autorestart=true | |
stdout_logfile=/var/log/supervisor/android-emulator.log | |
stderr_logfile=/var/log/supervisor/android-emulator.err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment