Commit b3534ff5 authored by Eduardo Silva's avatar Eduardo Silva

Fix Dockerfile of practical example

parent 5e63a330
FROM debian:8
FROM jcsilva/docker-kaldi-gstreamer-server
MAINTAINER Eduardo Silva <zedudu@gmail.com>
RUN apt-get update && apt-get install -y \
autoconf \
automake \
bzip2 \
g++ \
git \
gstreamer1.0-plugins-good \
gstreamer1.0-tools \
gstreamer1.0-pulseaudio \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-ugly \
libatlas3-base \
libgstreamer1.0-dev \
libtool-bin \
make \
python2.7 \
python-pip \
python-yaml \
python-simplejson \
python-gi \
subversion \
wget \
zlib1g-dev && \
apt-get clean autoclean && \
apt-get autoremove -y && \
pip install ws4py==0.3.2 && \
pip install tornado && \
ln -s /usr/bin/python2.7 /usr/bin/python ; ln -s -f bash /bin/sh
RUN cd /opt && wget http://www.digip.org/jansson/releases/jansson-2.7.tar.bz2 && \
bunzip2 -c jansson-2.7.tar.bz2 | tar xf - && \
cd jansson-2.7 && \
./configure && make && make check && make install && \
echo "/usr/local/lib" >> /etc/ld.so.conf.d/jansson.conf && ldconfig && \
rm /opt/jansson-2.7.tar.bz2 && rm -rf /opt/jansson-2.7
RUN cd /opt && \
git clone https://github.com/kaldi-asr/kaldi && \
cd /opt/kaldi/tools && \
make && \
./install_portaudio.sh && \
cd /opt/kaldi/src && ./configure --shared && \
sed -i '/-g # -O0 -DKALDI_PARANOID/c\-O3 -DNDEBUG' kaldi.mk && \
make depend && make && \
cd /opt/kaldi/src/online && make depend && make && \
cd /opt/kaldi/src/gst-plugin && make depend && make && \
cd /opt && \
git clone https://github.com/alumae/gst-kaldi-nnet2-online.git && \
cd /opt/gst-kaldi-nnet2-online/src && \
sed -i '/KALDI_ROOT?=\/home\/tanel\/tools\/kaldi-trunk/c\KALDI_ROOT?=\/opt\/kaldi' Makefile && \
make depend && make && \
rm -rf /opt/gst-kaldi-nnet2-online/.git/ && \
find /opt/gst-kaldi-nnet2-online/src/ -type f -not -name '*.so' -delete && \
rm -rf /opt/kaldi/.git && \
rm -rf /opt/kaldi/egs/ /opt/kaldi/windows/ /opt/kaldi/misc/ && \
find /opt/kaldi/src/ -type f -not -name '*.so' -delete && \
find /opt/kaldi/tools/ -type f \( -not -name '*.so' -and -not -name '*.so*' \) -delete && \
cd /opt && git clone https://github.com/alumae/kaldi-gstreamer-server.git && \
rm -rf /opt/kaldi-gstreamer-server/.git/ && \
rm -rf /opt/kaldi-gstreamer-server/test/
COPY start.sh stop.sh /opt/
# This is the practical example part
RUN mkdir -p /opt/models && cd /opt/models && \
wget https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz && \
tar -zxvf tedlium_nnet_ms_sp_online.tgz && \
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/sample_english_nnet2.yaml -P /opt/models && \
find /opt/models/ -type f | xargs sed -i 's:test:/opt:g' && \
sed -i 's:full-post-processor:#full-post-processor:g' /opt/models/sample_english_nnet2.yaml
RUN chmod +x /opt/start.sh && \
chmod +x /opt/stop.sh
CMD /opt/start.sh -y /opt/models/sample_english_nnet2.yaml
wget https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz && \
tar -zxvf tedlium_nnet_ms_sp_online.tgz && \
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/sample_english_nnet2.yaml -P /opt/models && \
find /opt/models/ -type f | xargs sed -i 's:test:/opt:g' && \
sed -i 's:full-post-processor:#full-post-processor:g' /opt/models/sample_english_nnet2.yaml
RUN apt-get update && \
apt-get install -y supervisor && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]
#!/bin/bash
MASTER="localhost"
PORT=80
usage(){
echo "Creates a worker and connects it to a master.";
echo "If the master address is not given, a master will be created at localhost:80";
echo "Usage: $0 -y yaml_file [-m master address] [-p port number]";
}
while getopts "h?m:p:y:" opt; do
case "$opt" in
h|\?)
usage
exit 0
;;
m) MASTER=$OPTARG
;;
p) PORT=$OPTARG
;;
y) YAML=$OPTARG
;;
esac
done
#yaml file must be specified
if [ "$YAML" == "" ] ; then
usage;
exit 1;
fi;
if [ "$MASTER" == "localhost" ] ; then
# start a local master
python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=$PORT 2>> /opt/master.log &
fi
#start worker and connect it to the master
export GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/
python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c $YAML -u ws://$MASTER:$PORT/worker/ws/speech 2>> /opt/worker.log
#!/bin/bash
#kill worker
ps axf | grep worker.py | grep -v grep | awk '{print "kill -15 " $1}' | sh
#kill master
ps axf | grep master_server.py | grep -v grep | awk '{print "kill -15 " $1}' | sh
[supervisord]
nodaemon=true
[program:master]
command=python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=80
numprocs=1
autostart=true
autorestart=true
stderr_logfile=/opt/master.log
[program:worker]
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/sample_english_nnet2.yaml -u ws://localhost:80/worker/ws/speech
numprocs=1
autostart=true
autorestart=true
stderr_logfile=/opt/worker.log
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment