Skip to content

Commit

Permalink
fga-eps-mds#175 - Modifying docker to run application in emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronyell committed May 20, 2018
1 parent d8af0fe commit 0e1cddc
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 38 deletions.
78 changes: 44 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,39 @@ FROM java:8

#In Host-Terminal exec this command: sudo xhost +local:docker

# Intall unzip
RUN apt-get install unzip
# Install base software packages
RUN dpkg --add-architecture i386

RUN apt-get update && \
apt-get install software-properties-common \
python-software-properties \
wget \
curl \
git \
libncurses5:i386 \
libstdc++6:i386 \
zlib1g:i386 \
unzip -y && \
apt-get clean


# ——————————
# Install Node and global packages
# ——————————
ENV NODE_VERSION 6.11.2
RUN cd && \
wget -q http://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz && \
tar -xzf node-v${NODE_VERSION}-linux-x64.tar.gz && \
mv node-v${NODE_VERSION}-linux-x64 /opt/node && \
rm node-v${NODE_VERSION}-linux-x64.tar.gz
ENV PATH ${PATH}:/opt/node/bin


# ——————————
# Install Basic React-Native packages
# ——————————
RUN npm install -g create-react-native-app
RUN npm install -g react-native-cli

# Install SDK
RUN mkdir /app/
Expand All @@ -25,42 +56,21 @@ RUN yes | $ANDROID_HOME/tools/bin/sdkmanager "tools"

RUN echo "y" | android update sdk


RUN $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-23"
RUN $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-25"
RUN $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-25;google_apis;x86"

ENV ANDROID_COMPONENTS platform-tools,build-tools-25.0.1,android-25,build-tools-21.0.0,android-21
ENV GOOGLE_COMPONENTS extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services,extra-google-gcm

RUN echo y | android update sdk --no-ui --all --filter "${ANDROID_COMPONENTS}" ; \
echo y | android update sdk --no-ui --all --filter "${GOOGLE_COMPONENTS}"

ENV QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb

# Create AVD
RUN $ANDROID_HOME/tools/bin/avdmanager create avd\
-n android-emulator\
-n emulator-android\
-k "system-images;android-25;google_apis;x86"\
--device "Nexus 5"\
--sdcard 100M


# Install base software packages
RUN apt-get update && \
apt-get install software-properties-common \
python-software-properties \
wget \
curl \
git \
unzip -y && \
apt-get clean


# ——————————
# Install Node and global packages
# ——————————
ENV NODE_VERSION 6.11.2
RUN cd && \
wget -q http://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz && \
tar -xzf node-v${NODE_VERSION}-linux-x64.tar.gz && \
mv node-v${NODE_VERSION}-linux-x64 /opt/node && \
rm node-v${NODE_VERSION}-linux-x64.tar.gz
ENV PATH ${PATH}:/opt/node/bin


# ——————————
# Install Basic React-Native packages
# ——————————
RUN npm install -g create-react-native-app
--sdcard 700M
10 changes: 6 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
android-emulator-merenda:
merenda-merenda:
build: .
volumes:
- .:/code
privileged: true
working_dir: /code
net: host
environment:
- DISPLAY=$DISPLAY
command: |
bash -c "
cd /code/ && npm install
npm install --loglevel verbose
adb reverse tcp:8081 tcp:8081
/app/android-sdk-linux/tools/android list avd
/app/android-sdk-linux/tools/emulator -avd android-emulator & .
sleep 2m && npm run android
react-native run-android & .
/app/android-sdk-linux/tools/emulator -avd emulator-android
"

0 comments on commit 0e1cddc

Please sign in to comment.