From ecf6d56c21004e526912eed7a5b17a4e67937d0a Mon Sep 17 00:00:00 2001 From: bjoern Date: Thu, 28 Jan 2016 00:35:11 +0100 Subject: add Docerfile and docker entrypoint script for quickstart --- docker-ep.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100755 docker-ep.sh (limited to 'docker-ep.sh') diff --git a/docker-ep.sh b/docker-ep.sh new file mode 100755 index 0000000..2f949f5 --- /dev/null +++ b/docker-ep.sh @@ -0,0 +1,80 @@ +#!/bin/bash +## +## entrypoint for the docker images + +groupmod -g $gid voc +usermod -u $uid -g $gid voc + +# check if homedir is mounted +if grep -q '/home/voc' /proc/mounts; then + # homedir is mounted into the docker so don't touch the ownership of the files + true +else + # fixup for changed uid and gid + chown -R voc:voc /home/voc +fi + +function startCore() { + if [ -x /bin/gosu ]; then + gosu voc /opt/voctomix/voctocore/voctocore.py -v + else + echo "no gosu found..." + exec su -l -c "/opt/voctomix/voctocore/voctocore.py -v" voc + fi +} + +function isVideoMounted() { + return grep -q '/video' /proc/mounts +} + +function startGui() { + if [ -x /bin/gosu ]; then + gosu voc /opt/voctomix/voctocore/voctocore.py -v + else + echo "no gosu found..." + exec su -l -c "/opt/voctomix/voctogui/voctogui.py -v" voc + fi +} + +function listExamples() { + cd example-scripts/ + find -type f +} + +function runExample() { + if [ -z $1 ]; then + echo "no valid example! " + fi + FILENAME="example-scripts/$1" + if [ -f ${FILENAME} ]; then + echo "Running: ${FILENAME}" + ${FILENAME} + fi +} + +function usage() { + echo "Usage: $0 " + echo "help - this text" + echo "core - starts voctomix gore" + echo "gui - starts the voctomix GUI" + echo "examples - lists the example scripts" + echo "scriptname.py - starts the example script named 'scriptname.py' " +} + +case $1 in + help ) + usage + ;; + examples ) + listExamples + ;; + gui ) + startGui + ;; + core ) + startCore + ;; + * ) + runExample $1 + ;; +esac \ No newline at end of file -- cgit v1.2.3 From 8c3ab546a9769f35e624edb5067be02c7de8ccf6 Mon Sep 17 00:00:00 2001 From: bjoern Date: Thu, 28 Jan 2016 00:39:34 +0100 Subject: add interactive bash to entrypoint --- docker-ep.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docker-ep.sh') diff --git a/docker-ep.sh b/docker-ep.sh index 2f949f5..aa8e8a2 100755 --- a/docker-ep.sh +++ b/docker-ep.sh @@ -58,6 +58,7 @@ function usage() { echo "core - starts voctomix gore" echo "gui - starts the voctomix GUI" echo "examples - lists the example scripts" + echo "bash - run interactive bash" echo "scriptname.py - starts the example script named 'scriptname.py' " } @@ -74,6 +75,10 @@ case $1 in core ) startCore ;; + bash ) + shift + bash $@ + ;; * ) runExample $1 ;; -- cgit v1.2.3 From d2d5e14aa309d4167aba14504e01ec8d3157c0a8 Mon Sep 17 00:00:00 2001 From: bjoern Date: Wed, 17 Feb 2016 17:29:42 +0100 Subject: check if the entrypint script is run in a docker --- docker-ep.sh | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'docker-ep.sh') diff --git a/docker-ep.sh b/docker-ep.sh index aa8e8a2..3e2b630 100755 --- a/docker-ep.sh +++ b/docker-ep.sh @@ -2,16 +2,23 @@ ## ## entrypoint for the docker images -groupmod -g $gid voc -usermod -u $uid -g $gid voc +if [ ! -f /.dockerenv ] && [ ! -f /.dockerinit ]; then + echo "WARNING: this scrip should be only runed inside docker!!" + exit 1 +fi + +if [ ! -z $gid ] && [ ! -z $uid ]; then + groupmod -g $gid voc + usermod -u $uid -g $gid voc -# check if homedir is mounted -if grep -q '/home/voc' /proc/mounts; then - # homedir is mounted into the docker so don't touch the ownership of the files - true -else - # fixup for changed uid and gid - chown -R voc:voc /home/voc + # check if homedir is mounted + if grep -q '/home/voc' /proc/mounts; then + # homedir is mounted into the docker so don't touch the ownership of the files + true + else + # fixup for changed uid and gid + chown -R voc:voc /home/voc + fi fi function startCore() { @@ -62,6 +69,11 @@ function usage() { echo "scriptname.py - starts the example script named 'scriptname.py' " } +if [ -z $1 ]; then + usage + exit +fi + case $1 in help ) usage @@ -82,4 +94,4 @@ case $1 in * ) runExample $1 ;; -esac \ No newline at end of file +esac -- cgit v1.2.3 From d1091db7fa298f8052310776fc90b8289f17f0bf Mon Sep 17 00:00:00 2001 From: Bjoern Date: Thu, 18 Feb 2016 17:09:14 +0100 Subject: fix: start voctogui instead of core when requested --- docker-ep.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docker-ep.sh') diff --git a/docker-ep.sh b/docker-ep.sh index 3e2b630..e61bad5 100755 --- a/docker-ep.sh +++ b/docker-ep.sh @@ -22,6 +22,7 @@ if [ ! -z $gid ] && [ ! -z $uid ]; then fi function startCore() { + echo "Starting Voctomix CORE" if [ -x /bin/gosu ]; then gosu voc /opt/voctomix/voctocore/voctocore.py -v else @@ -35,8 +36,9 @@ function isVideoMounted() { } function startGui() { + echo "Starting Voctomix GUI..." if [ -x /bin/gosu ]; then - gosu voc /opt/voctomix/voctocore/voctocore.py -v + gosu voc /opt/voctomix/voctogui/voctogui.py -v else echo "no gosu found..." exec su -l -c "/opt/voctomix/voctogui/voctogui.py -v" voc -- cgit v1.2.3 From d83f3983119d0a9c97b684c94eaeb8ed58fdb591 Mon Sep 17 00:00:00 2001 From: bjoern Date: Thu, 18 Feb 2016 18:09:55 +0100 Subject: some typo fixes in the documentation --- README_DOCKER.md | 2 +- docker-ep.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docker-ep.sh') diff --git a/README_DOCKER.md b/README_DOCKER.md index 038af85..e03e77b 100644 --- a/README_DOCKER.md +++ b/README_DOCKER.md @@ -25,7 +25,7 @@ docker run --rm -it --name=voctocore local/voctomix core ``` ### Source example scripts ``` -docker run -it --rm --name=cam1 --link=voctocore:corehost local/voctomix ./gstreamer/source-videotestsrc-as-cam1.sh +docker run -it --rm --name=cam1 --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-cam1.sh docker run -it --rm --name=bg --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-background-loop.sh ``` diff --git a/docker-ep.sh b/docker-ep.sh index e61bad5..17b1ac4 100755 --- a/docker-ep.sh +++ b/docker-ep.sh @@ -3,7 +3,7 @@ ## entrypoint for the docker images if [ ! -f /.dockerenv ] && [ ! -f /.dockerinit ]; then - echo "WARNING: this scrip should be only runed inside docker!!" + echo "WARNING: this script should be only run inside docker!!" exit 1 fi -- cgit v1.2.3