changeset 9:30648126316b

added docker related files
author Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
date Sat, 01 Dec 2018 15:44:05 +0000
parents 51edbf10b9b4
children fff6981fecd1
files Dockerfile README.md bootstrap.sh download_voices.sh fluxbox-menu run_docker.sh
diffstat 6 files changed, 291 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dockerfile	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,102 @@
+FROM ubuntu:xenial
+RUN apt-get update; apt-get clean
+RUN apt-get install -y openssh-server
+
+# Add a user for running applications
+RUN useradd apps
+RUN mkdir -p /home/apps && chown apps:apps /home/apps
+
+# Install x11vnc
+RUN apt-get install -y x11vnc
+
+# Install xfvb
+RUN apt-get install -y xvfb
+
+# Install fluxbox
+RUN apt-get install -y fluxbox
+
+# Install wget 
+RUN apt-get install -y wget
+
+# Install wmctrl
+RUN apt-get install -y wmctrl
+
+# Set the Chrome repo.
+RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
+    && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
+
+# Install Chrome
+RUN apt-get -y update && apt-get -y install google-chrome-stable
+
+# Install libreoffice-calc
+RUN apt-get -y install libreoffice-calc
+
+# Install festival
+RUN apt-get -y install festival festlex-cmu festvox-kallpc16k festvox-kdlpc16k  festlex-oald festvox-don festvox-ellpc11k festvox-en1 festvox-rablpc16k festvox-us1 festvox-us2 festvox-us3
+
+# Install sox
+RUN apt-get -y install sox
+
+# Install mercurial and git
+RUN apt-get -y install mercurial git
+
+# Install a text editor
+RUN apt-get -y install leafpad
+
+# Download and install neuralcoref
+RUN apt-get update -y && apt-get install python3.5
+
+# Build dependencies
+RUN apt-get install -y python3-pip
+
+# Neural coref
+RUN cd ~ && git clone https://github.com/huggingface/neuralcoref.git && cd neuralcoref && git checkout 5857502b3e74f8dae4c5c868b0b75fbfd88a32ae && pip3 install .
+
+
+# Pip stuff
+
+RUN pip3 install numpy scipy matplotlib pypeg2 spacy sklearn sklearn_crfsuite librosa pandas sox nltk xlwt xlrd selenium soundfile chromedriver
+RUN python3 -m spacy download en
+
+# Brat
+RUN su apps -c 'cd ~ && git clone https://github.com/nlplab/brat'
+RUN su apps -c 'cd ~/brat && rm -rf data && mkdir data && mkdir data/workspace'
+
+
+# Radioplays dependencies
+RUN pip3 install filelock
+
+# Python3-tk
+RUN apt-get install -y python3-tk
+
+# Install ffmpeg
+RUN apt-get install -y ffmpeg
+
+# Install mplayer
+RUN apt-get install -y mplayer
+
+# Install simple file browser
+RUN apt-get install -y pcmanfm
+
+# Install chrome-driver
+RUN apt-get install -y unzip
+RUN wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && mv chromedriver /usr/bin/chromedriver && chown root:root /usr/bin/chromedriver && chmod +x /usr/bin/chromedriver
+
+RUN su apps -c 'cd ~ && hg clone https://code.soundsoftware.ac.uk/hg/chourdakisreiss2018smc'
+CMD su apps -c  'cd ~/chourdakis2018smc && hg pull && hg update'
+
+COPY fluxbox-menu /etc/X11/fluxbox/
+
+# COPY download_voices.sh /
+# RUN ["chmod", "+x", "/download_voices.sh"]
+# RUN ["bash", "/download_voices.sh"]
+
+ADD voices/festival/lib/voices/us /usr/share/festival/voices/english/
+COPY bootstrap.sh /
+RUN ["chmod", "+x", "/bootstrap.sh"]
+CMD '/bootstrap.sh'
+# CMD '/bootstrap.sh'
+
+# On recent linux kernels, you need to run: `echo N | sudo tee /sys/module/overlay/parameters/metacopy` before each build
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,13 @@
+# How to Use
+
+The demo is provided as a Dockerfile.
+
+## Requirements
+
+1. (Docker)[https://docs.docker.com/get-started/]
+2. A Linux host. System tried is: `Linux 4.19.4-arch1-1-ARCH #1 SMP PREEMPT Fri Nov 23 09:06:58 UTC 2018 x86_64 GNU/Linux` with LSB `1.4`
+    1. **Note**: Due to a recent issue, the following line must be run before trying to build the container: `echo N | sudo tee /sys/module/overlay/parameters/metacopy`
+
+## Installation
+
+1. Clone this repo: `hg clone https://code.soundsoftware.ac.uk/hg/chourdakisreiss2018smc`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bootstrap.sh	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,84 @@
+#!/bin/bash
+# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb
+
+readonly G_LOG_I='[INFO]'
+readonly G_LOG_W='[WARN]'
+readonly G_LOG_E='[ERROR]'
+
+main() {
+    launch_xvfb
+    launch_window_manager
+    run_vnc_server
+}
+
+launch_xvfb() {
+    # Set defaults if the user did not specify envs.
+    export DISPLAY=${XVFB_DISPLAY:-:1}
+    local screen=${XVFB_SCREEN:-0}
+    local resolution=${XVFB_RESOLUTION:-1280x1024x24}
+    local timeout=${XVFB_TIMEOUT:-5}
+
+    # Start and wait for either Xvfb to be fully up or we hit the timeout.
+    Xvfb ${DISPLAY} -screen ${screen} ${resolution} &
+    local loopCount=0
+    until xdpyinfo -display ${DISPLAY} > /dev/null 2>&1
+    do
+        loopCount=$((loopCount+1))
+        sleep 1
+        if [ ${loopCount} -gt ${timeout} ]
+        then
+            echo "${G_LOG_E} xvfb failed to start."
+            exit 1
+        fi
+    done
+}
+
+launch_window_manager() {
+    local timeout=${XVFB_TIMEOUT:-5}
+
+    # Start and wait for either fluxbox to be fully up or we hit the timeout.
+    fluxbox &
+    local loopCount=0
+    until wmctrl -m > /dev/null 2>&1
+    do
+        loopCount=$((loopCount+1))
+        sleep 1
+        if [ ${loopCount} -gt ${timeout} ]
+        then
+            echo "${G_LOG_E} fluxbox failed to start."
+            exit 1
+        fi
+    done
+}
+
+run_vnc_server() {
+    local passwordArgument='-nopw'
+
+    if [ -n "${VNC_SERVER_PASSWORD}" ]
+    then
+        local passwordFilePath="${HOME}/x11vnc.pass"
+        if ! x11vnc -storepasswd "${VNC_SERVER_PASSWORD}" "${passwordFilePath}"
+        then
+            echo "${G_LOG_E} Failed to store x11vnc password."
+            exit 1
+        fi
+        passwordArgument=-"-rfbauth ${passwordFilePath}"
+        echo "${G_LOG_I} The VNC server will ask for a password."
+    else
+        echo "${G_LOG_W} The VNC server will NOT ask for a password."
+    fi
+
+    x11vnc -display ${DISPLAY} -forever ${passwordArgument} &
+    wait $!
+}
+
+control_c() {
+    echo ""
+    exit
+}
+
+trap control_c SIGINT SIGTERM SIGHUP
+
+main
+
+exit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/download_voices.sh	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+VOICES="festvox_cmu_us_ahw_cg festvox_cmu_us_aup_cg festvox_cmu_us_awb_cg festvox_cmu_us_axb_cg festvox_cmu_us_bdl_cg festvox_cmu_us_clb_cg  festvox_cmu_us_fem_cg festvox_cmu_us_gka_cg festvox_cmu_us_jmk_cg festvox_cmu_us_ksp_cg  festvox_cmu_us_rms_cg festvox_cmu_us_rxr_cg  festvox_cmu_us_slt_cg"
+
+if [ ! -d voices ]; then
+    mkdir voices
+fi
+
+for VOICE in $VOICES; do
+    echo "Downloading: $VOICE"
+    if [ ! -f voices/$VOICE.tar.gz ]; then
+       wget --quiet "http://festvox.org/packed/festival/2.4/voices/$VOICE.tar.gz" -O voices/$VOICE.tar.gz
+
+    fi
+
+    echo "Uncompressing $VOICE.tar.gz"...
+    cd voices; tar xzf $VOICE.tar.gz; cd -
+
+
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fluxbox-menu	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# Please see <file:/usr/share/doc/menu/README> for information.
+
+# to use your own menu, copy this to ~/.fluxbox/menu, then edit
+# ~/.fluxbox/init and change the session.menuFile path to ~/.fluxbox/menu
+
+[begin] (Fluxbox)
+
+# Automatically generated file. Do not edit (see /usr/share/doc/menu/html/index.html)
+
+   [submenu] (radioplay-gen) {}
+        [exec] (0 - Setup brat) { x-terminal-emulator -e "cd ~/brat && bash install.sh" }
+        [exec] (1 - Semantic Analysis) { x-terminal-emulator -e "cd ~/chourdakisreiss2018smc/demo/workspace && bash semantic_analysis.sh" }
+        [exec] (2 - Radioplay Render ) { x-terminal-emulator -e "cd ~/chourdakisreiss2018smc/demo/workspace && bash radioplay_render.sh" }     
+        [exec] (X - Browse folder) { pcmanfm ~/chourdakisreiss2018smc }
+   [end]
+   [submenu] (Applications) {}
+      [submenu] (Editors) {}
+         [exec] (LeafPad) {/usr/bin/leafpad} </usr/share/pixmaps/leafpad.xpm>
+      [end]
+      [submenu] (Network) {}
+         [submenu] (Web Browsing) {}
+            [exec] (Google Chrome) {/opt/google/chrome/google-chrome} </opt/google/chrome/product_logo_32.xpm>
+         [end]
+      [end]
+      [submenu] (Programming) {}
+         [exec] (Tclsh8.6) { x-terminal-emulator -T "Tclsh8.6" -e /usr/bin/tclsh8.6} <>
+         [exec] (TkWish8.6) {x-terminal-emulator -e /usr/bin/wish8.6} <>
+      [end]
+      [submenu] (Shells) {}
+         [exec] (Bash) { x-terminal-emulator -T "Bash" -e /bin/bash --login} <>
+         [exec] (Dash) { x-terminal-emulator -T "Dash" -e /bin/dash -i} <>
+         [exec] (Sh) { x-terminal-emulator -T "Sh" -e /bin/sh --login} <>
+      [end]
+      [submenu] (System) {}
+         [submenu] (Administration) {}
+            [exec] (Editres) {editres} <>
+            [exec] (Xfontsel) {xfontsel} <>
+            [exec] (Xkill) {xkill} <>
+            [exec] (Xrefresh) {xrefresh} <>
+         [end]
+         [submenu] (Hardware) {}
+            [exec] (Xvidtune) {xvidtune} <>
+         [end]
+         [submenu] (Monitoring) {}
+            [exec] (Top) { x-terminal-emulator -T "Top" -e /usr/bin/top} <>
+            [exec] (Xev) {x-terminal-emulator -e xev} <>
+         [end]
+      [end]
+      [submenu] (Terminal Emulators) {}
+         [exec] (XTerm) {xterm} </usr/share/pixmaps/xterm-color_32x32.xpm>
+         [exec] (XTerm (Unicode\)) {uxterm} </usr/share/pixmaps/xterm-color_32x32.xpm>
+      [end]
+   [end]
+
+   [submenu] (Window Managers) {}
+      [restart] (FluxBox)  {/usr/bin/startfluxbox}
+   [end]
+
+   [config] (Configuration)
+   [submenu] (Styles) {}
+      [stylesdir] (/usr/share/fluxbox/styles)
+      [stylesdir] (~/.fluxbox/styles)
+   [end]
+
+   [workspaces] (Workspaces)
+   [reconfig] (Reconfigure)
+   [restart] (Restart)
+   [exit] (Exit)
+
+[end]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run_docker.sh	Sat Dec 01 15:44:05 2018 +0000
@@ -0,0 +1,1 @@
+docker run -p 5900:5900 --user apps -v /dev/snd:/dev/snd -ti -v $(pwd):/mnt --privileged radioplays