Added auto-stop feature
This commit is contained in:
parent
b5f8c28fc1
commit
705be0e3c9
|
@ -115,5 +115,7 @@ EXPOSE 4723 6080 5555
|
||||||
COPY src /root/src
|
COPY src /root/src
|
||||||
COPY supervisord.conf /root/
|
COPY supervisord.conf /root/
|
||||||
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||||
|
COPY genymotion/geny_start.sh /root
|
||||||
|
RUN chmod +x /root/geny_start.sh
|
||||||
|
|
||||||
CMD /usr/bin/supervisord --configuration supervisord.conf
|
CMD ["./geny_start.sh"]
|
||||||
|
|
31
geny.yml
Normal file
31
geny.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# Note: It requires docker-compose 1.13.0
|
||||||
|
#
|
||||||
|
# Usage: docker-compose up -d
|
||||||
|
version: "2.2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# Selenium hub
|
||||||
|
selenium_hub:
|
||||||
|
image: selenium/hub:3.12.0-americium
|
||||||
|
ports:
|
||||||
|
- 4444:4444
|
||||||
|
|
||||||
|
# Please stop this container by using docker stop instead of docker-compose stop
|
||||||
|
genymotion:
|
||||||
|
image: geny
|
||||||
|
depends_on:
|
||||||
|
- selenium_hub
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- 6080:6080
|
||||||
|
- 4723:4723
|
||||||
|
volumes:
|
||||||
|
- $PWD/example/sample_apk:/opt
|
||||||
|
- $PWD/genymotion/sample:/root/tmp
|
||||||
|
environment:
|
||||||
|
- GENY_TEMPLATE=/root/tmp/devices.json
|
||||||
|
- USER=xxx
|
||||||
|
- PASS=xxx
|
||||||
|
- LICENSE=xxx
|
||||||
|
- CONNECT_TO_GRID=True
|
||||||
|
- APPIUM=true
|
27
genymotion/geny_start.sh
Executable file
27
genymotion/geny_start.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
|
||||||
|
|
||||||
|
if [ -z "$GENY_TEMPLATE" ]; then
|
||||||
|
GENY_TEMPLATE="/root/tmp/devices.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$GENY_TEMPLATE" ]; then
|
||||||
|
echo "File not found! Nothing to do!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
contents=$(cat $GENY_TEMPLATE)
|
||||||
|
getAbort() {
|
||||||
|
echo "ABORT SIGNAL detected! Stopping all created emulators..."
|
||||||
|
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
||||||
|
get_value() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
gmtool --cloud admin stopdisposable $(get_value '.device')
|
||||||
|
done
|
||||||
|
echo "Done"
|
||||||
|
}
|
||||||
|
trap 'getAbort; exit' EXIT
|
||||||
|
|
||||||
|
/usr/bin/supervisord --configuration supervisord.conf
|
|
@ -4,11 +4,6 @@ if [ -z "$GENY_TEMPLATE" ]; then
|
||||||
GENY_TEMPLATE="/root/tmp/devices.json"
|
GENY_TEMPLATE="/root/tmp/devices.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$GENY_TEMPLATE" ]; then
|
|
||||||
echo "File not found! Nothing to do!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
contents=$(cat $GENY_TEMPLATE)
|
contents=$(cat $GENY_TEMPLATE)
|
||||||
|
|
||||||
function prepare_geny_cloud() {
|
function prepare_geny_cloud() {
|
||||||
|
|
Loading…
Reference in a new issue