diff --git a/android/Dockerfile b/android/Dockerfile index 35f4af1..ac119a9 100644 --- a/android/Dockerfile +++ b/android/Dockerfile @@ -5,7 +5,7 @@ ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/andro RUN sdkmanager "system-images;android-33;google_apis;x86_64" RUN echo no | avdmanager create avd -n virtual_dev -b google_apis/x86_64 -k "system-images;android-33;google_apis;x86_64" -RUN apt-get update && apt-get install -y iproute2 iputils-ping iptables redsocks npm +RUN apt-get update && apt-get install -y iproute2 iputils-ping iptables redsocks npm git EXPOSE 3000 diff --git a/android/conf/docker-entrypoint.sh b/android/conf/docker-entrypoint.sh index 38c8ede..1470691 100644 --- a/android/conf/docker-entrypoint.sh +++ b/android/conf/docker-entrypoint.sh @@ -1,11 +1,12 @@ hashed_name=`openssl x509 -inform PEM -subject_hash_old -in /ca-cert.cer | head -1` +emulator -avd virtual_dev -writable-system -no-window -no-audio & npm i -C /code cp /ca-cert.cer /$hashed_name.0 +bash /conf/install_cert.sh $hashed_name.0 +bash /conf/install_culebra.sh bash /conf/iptables_conf.sh redsocks -c /conf/redsocks.conf & -emulator -avd virtual_dev -writable-system -no-window -no-audio & -bash /conf/install_cert.sh $hashed_name.0 bash /conf/wait_for_sd.sh #wait for cert to be installed before launching socket server node /code/index.js diff --git a/android/conf/install_culebra.sh b/android/conf/install_culebra.sh new file mode 100644 index 0000000..336d1a1 --- /dev/null +++ b/android/conf/install_culebra.sh @@ -0,0 +1,15 @@ +cd /root +git clone https://github.com/dtmilano/CulebraTester2-public culebra +git clone https://gist.github.com/dtmilano/4537110 culebraDependencies +export PATH=$PATH:/root/culebraDependencies + +cd culebra +git checkout 4ce1987e7ec6ae627d8f33a1a3b59f684aff90c0 +echo "/opt/android-sdk-linux" >> local.properties +./gradlew installDebug installDebugAndroidTest +./culebratester2 start-server & + +#wait for the server to start +while ! curl http://localhost:9987/v2/uiDevice/screenshot > /dev/null 2> /dev/null; do + sleep 0.1 +done \ No newline at end of file diff --git a/android/conf/screenshot.sh b/android/conf/screenshot.sh index 0ec03b2..9f4f3c1 100755 --- a/android/conf/screenshot.sh +++ b/android/conf/screenshot.sh @@ -1,2 +1 @@ -/opt/android-sdk-linux/platform-tools/adb shell screencap /sdcard/screenshot.png -/opt/android-sdk-linux/platform-tools/adb pull /sdcard/screenshot.png /screenshot.png \ No newline at end of file +curl http://localhost:9987/v2/uiDevice/screenshot -o /screenshot.png \ No newline at end of file diff --git a/http_server/Dockerfile b/http_server/Dockerfile index 6c468a0..1fa58d2 100644 --- a/http_server/Dockerfile +++ b/http_server/Dockerfile @@ -6,6 +6,6 @@ WORKDIR /code RUN mkdir /images -ENV screenshotDelayMs 1000 +ENV screenshotDelayMs 500 CMD sh /code/docker-entrypoint.sh \ No newline at end of file