Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build your APK beyond Docker #dockerlt

Rize MISUMI
October 14, 2015

Build your APK beyond Docker #dockerlt

at Docker 実践 LT

Rize MISUMI

October 14, 2015
Tweet

More Decks by Rize MISUMI

Other Decks in Technology

Transcript

  1. Testing APK is difficult → Developer specific problem → CI

    service specific problem → APK's state (SQLite, Preference, etc.)
  2. Container as CI Service → Docker as a function (Travis

    CI, CircleCI, Wercker) → Based on Docker (Drone)
  3. FROM misumirize/android-sdk RUN mkdir /project COPY . /project WORKDIR /project

    RUN echo "sdk.dir=$ANDROID_HOME" > local.properties ENTRYPOINT ["./gradlew"] CMD ["tasks"]
  4. Run unit tests and generate APK $ docker build -t

    android-build . $ docker run android-build build
  5. Too slow and frustrating ARM emulator cf. Travis CI $

    echo no | android create avd --force \ --name test --target android-23 --abi armeabi-v7a $ emulator64-arm -avd test -no-skin -no-audio -no-window & $ android-wait-for-emulator $ adb shell input keyevent 82 & $ ./gradlew connectedCheck
  6. Problem: → ./gradlew connectedCheck wraps ADB client → We can't

    configure the host of ADB client → ADB server binds to the loopback address only
  7. Client (container) frontend local_adb_server bind 127.0.0.1:5037 mode tcp default_backend remote_adb_server

    backend remote_adb_server mode tcp server remote01 123.45.67.89:5036 check
  8. Server (devices connected) frontend remote_adb_server bind *:5036 mode tcp default_backend

    internal_adb_server backend internal_adb_server mode tcp server internal01 127.0.0.1:5037 check
  9. misumirize/android-remote-client ONBUILD COPY haproxy.cfg /etc/haproxy/haproxy.cfg ONBUILD COPY . /project WORKDIR

    /project ONBUILD RUN echo "sdk.dir=$ANDROID_HOME" > local.properties ENTRYPOINT ["execute-remote"]
  10. Conclusion → Docker is protocol → Separating role (even forcefully)

    is important → ONBUILD is useful. Consider using ONBUILD
  11. → Android Lineup - Shadow by Rob Bulmahn → Desastrosos

    by srgpicker → cyclotron by Robert Couse-Baker → Containing the containers by Erik Söderström → Nexus 7 with Android 5 by Yuri Samoilov → IMAG0191 by Robert → Hornby Separated Bike Lane by Paul Krueger → A Street Called Awesome by Selena N. B. H.