aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjoern <bjoern.riemer@web.de>2016-01-28 00:35:11 +0100
committerbjoern <bjoern.riemer@web.de>2016-02-17 17:31:16 +0100
commitecf6d56c21004e526912eed7a5b17a4e67937d0a (patch)
tree24e24c7533e1db7ff5cb877f4957a22d22392f6a
parent8594dba0a9a72554dddc3a151da969750675e9b3 (diff)
add Docerfile and docker entrypoint script for quickstart
-rw-r--r--Dockerfile50
-rwxr-xr-xdocker-ep.sh80
2 files changed, 130 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e8db06b
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,50 @@
+## re-build:
+# docker tag bjoernr/voctocore:latest bjoernr/voctocore:old; docker build -t bjoernr/voctocore ./voctocore-docker && docker rmi bjoernr/voctocore:old
+## build:
+# docker build -t bjoernr/voctocore ./voctocore-docker
+## run:
+# docker run -it --rm bjoernr/voctocore
+# docker run -it --rm -v /some/dir:/video
+# -p 9999:9999 -p 10000:10000 -p 10001:10001 -p 10002:10002 -p 11000:11000 -p 12000:12000 \
+# -p 13000:13000 -p 13001:13001 -p 13002:13002 -p 14000:14000 -p 15000:15000 -p 16000:16000 \
+# -p 17000:17000 -p 17001:17001 -p 17002:17002 -p 18000:18000 --name=voctocore bjoernr/voctocore
+
+FROM ubuntu:wily
+
+MAINTAINER Bjoern Riemer <bjoern.riemer@web.de>
+
+ENV DEBIAN_FRONTEND noninteractive
+
+ENV uid 1000
+ENV gid 1000
+
+RUN useradd -m voc
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
+ gstreamer1.0-plugins-ugly gstreamer1.0-tools libgstreamer1.0-0 python3 python3-gi gir1.2-gstreamer-1.0 \
+ && apt-get install -y git wget \
+ && apt-get clean
+
+# stuff for the GUI
+RUN apt-get update \
+ && apt-get install -y gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 \
+ ffmpeg \
+ && apt-get clean
+
+RUN wget -q https://github.com/tianon/gosu/releases/download/1.7/gosu-amd64 -O /bin/gosu && chmod +x /bin/gosu
+#RUN cd /opt && git clone https://github.com/voc/voctomix.git
+RUN mkdir -p /opt/voctomix
+
+EXPOSE 9998 9999 10000 10001 10002 11000 12000 13000 13001 13002 14000 15000 16000 17000 17001 17002 18000
+VOLUME /video
+
+WORKDIR /opt/voctomix
+COPY . /opt/voctomix/
+
+RUN sed -i 's/localhost/corehost/g' voctogui/default-config.ini \
+ && find /opt/voctomix/example-scripts/ -type f -exec sed -i 's/localhost/corehost/g' {} \;
+
+ENTRYPOINT ["/opt/voctomix/docker-ep.sh"]
+CMD ["help"] \ No newline at end of file
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 <cmd>"
+ 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