Эх сурвалжийг харах

update snowboy lib to 1.3.0 + review compilation via docker

#414
nico 7 жил өмнө
parent
commit
faa5252ca5

+ 17 - 5
docker/docker.md

@@ -1,8 +1,11 @@
-# Docker deployment and tests
+# Docker 
 
 
-## Create images
+## Unit Tests
+
+### Create images
+
+#### Ubuntu 16.04
 
 
-### Ubuntu 16.04
 Build the image for Ubuntu 16.04. By default, the master branch of the Kalliope project will be cloned.
 Build the image for Ubuntu 16.04. By default, the master branch of the Kalliope project will be cloned.
 ```
 ```
 docker build --force-rm=true -t kalliope-ubuntu1604 -f docker/ubuntu_16_04.dockerfile .
 docker build --force-rm=true -t kalliope-ubuntu1604 -f docker/ubuntu_16_04.dockerfile .
@@ -20,7 +23,8 @@ docker build \
 -f docker/ubuntu_16_04.dockerfile .
 -f docker/ubuntu_16_04.dockerfile .
 ```
 ```
 
 
-### Debian Jessie
+#### Debian Jessie
+
 Build the image for Debian Jessie. By default, the master branch of the Kalliope project will be cloned.
 Build the image for Debian Jessie. By default, the master branch of the Kalliope project will be cloned.
 ```
 ```
 docker build --force-rm=true -t kalliope-debian8 -f docker/debian8.dockerfile .
 docker build --force-rm=true -t kalliope-debian8 -f docker/debian8.dockerfile .
@@ -38,7 +42,7 @@ docker build \
 -f docker/debian8.dockerfile .
 -f docker/debian8.dockerfile .
 ```
 ```
 
 
-## Run the test
+### Run the test
 
 
 Ubuntu image
 Ubuntu image
 ```
 ```
@@ -49,3 +53,11 @@ Debian image
 ```
 ```
 docker run -it --rm kalliope-debian8
 docker run -it --rm kalliope-debian8
 ```
 ```
+
+## Compile Snowboy
+
+All Snowboy binaries for x86_64 architecture can be compiled from the docker compose file
+```bash
+mkdir /tmp/snowboy
+docker-compose -f compose_compile_snowboy_all.yml up
+```

+ 9 - 11
docker/compile_snowboy.dockerfile → docker/snowboy-compile/compile_snowboy_python27.dockerfile

@@ -1,16 +1,18 @@
 # build last version
 # build last version
-# docker build --force-rm=true -t compile-snowboy-python3 -f compile_snowboy.dockerfile .
+# docker build --force-rm=true -t compile_snowboy_python27 -f compile_snowboy_python27.dockerfile .
 
 
 # build specified version
 # build specified version
-# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile-snowboy-python3 -f compile_snowboy.dockerfile .
+# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile_snowboy_python27 -f compile_snowboy_python27.dockerfile .
 
 
 # compile into local /tmp/snowboy
 # compile into local /tmp/snowboy
-# docker run -it --rm --mount type=bind,source=/tmp/snowboy,target=/data compile-snowboy-python3
+# docker run -it --rm -v /tmp/snowboy:/data compile_snowboy_python27
 
 
-FROM ubuntu:xenial
+FROM python:2.7-jessie
+
+ARG SNOWBOY_VERSION="1.3.0"
 
 
 RUN apt-get update
 RUN apt-get update
-RUN apt-get install -y git make g++ python3-dev libatlas3-base libblas-dev gfortran vim wget libpcre3-dev
+RUN apt-get install -y git make g++ python-dev libatlas-base-dev gfortran vim wget
 
 
 # get the last version of swig
 # get the last version of swig
 RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
 RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
@@ -25,15 +27,11 @@ RUN cd swig-3.0.12 && \
     install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
     install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
     cp -v -R Doc/* /usr/share/doc/swig-3.0.12
     cp -v -R Doc/* /usr/share/doc/swig-3.0.12
 
 
-# version can be 1.2.0, 1.1.1, 1.1.0, 1.0.4
-ARG SNOWBOY_VERSION="1.2.0"
-
 RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
 RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
 
 
-RUN sed -i "s|python-config|python3-config|g" snowboy-${SNOWBOY_VERSION}/swig/Python/Makefile
-RUN sed -i "s|-lf77blas -lcblas -llapack_atlas -latlas|-lquadmath -lgfortran -lblas /usr/lib/libcblas.so.3|g" snowboy-${SNOWBOY_VERSION}/swig/Python/Makefile
+
 RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && make
 RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && make
-RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && python3 -c "import _snowboydetect; print('OK')"
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && python -c "import _snowboydetect; print('OK')"
 # compiled binary will be placed into data folder
 # compiled binary will be placed into data folder
 RUN mkdir /data
 RUN mkdir /data
 CMD cp /snowboy-*/swig/Python/*.so /data
 CMD cp /snowboy-*/swig/Python/*.so /data

+ 10 - 13
docker/compile_snowboy_python34.dockerfile → docker/snowboy-compile/compile_snowboy_python34.dockerfile

@@ -1,16 +1,18 @@
 # build last version
 # build last version
-# docker build --force-rm=true -t compile-snowboy-python34 -f compile_snowboy_python34.dockerfile .
+# docker build --force-rm=true -t compile_snowboy_python34 -f compile_snowboy_python34.dockerfile .
 
 
 # build specified version
 # build specified version
-# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile-snowboy-python34 -f compile_snowboy_python34.dockerfile .
+# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile_snowboy_python34 -f compile_snowboy_python34.dockerfile .
 
 
 # compile into local /tmp/snowboy
 # compile into local /tmp/snowboy
-# docker run -it --rm --mount type=bind,source=/tmp/snowboy,target=/data compile-snowboy-python34
+# docker run -it --rm -v /tmp/snowboy:/data compile_snowboy_python34
 
 
-FROM ubuntu:trusty
+FROM python:3.4-jessie
+
+ARG SNOWBOY_VERSION="1.3.0"
 
 
 RUN apt-get update
 RUN apt-get update
-RUN apt-get install -y git make g++ python3-dev libatlas3-base libblas-dev gfortran vim wget libpcre3-dev
+RUN apt-get install -y git make g++ python3-dev libatlas3-base libblas-dev gfortran vim wget libpcre3-dev libtool libatlas-base-dev
 
 
 # get the last version of swig
 # get the last version of swig
 RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
 RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
@@ -25,15 +27,10 @@ RUN cd swig-3.0.12 && \
     install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
     install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
     cp -v -R Doc/* /usr/share/doc/swig-3.0.12
     cp -v -R Doc/* /usr/share/doc/swig-3.0.12
 
 
-# version can be 1.2.0, 1.1.1, 1.1.0, 1.0.4
-ARG SNOWBOY_VERSION="1.2.0"
-
 RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
 RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
 
 
-RUN sed -i "s|python-config|python3-config|g" snowboy-${SNOWBOY_VERSION}/swig/Python/Makefile
-RUN sed -i "s|-lf77blas -lcblas -llapack_atlas -latlas|-lquadmath -lgfortran -lblas /usr/lib/libcblas.so.3|g" snowboy-${SNOWBOY_VERSION}/swig/Python/Makefile
-RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && make
-RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python && python3 -c "import _snowboydetect; print('OK')"
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && make
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && python3 -c "import _snowboydetect; print('OK')"
 # compiled binary will be placed into data folder
 # compiled binary will be placed into data folder
 RUN mkdir /data
 RUN mkdir /data
-CMD cp /snowboy-*/swig/Python/*.so /data
+CMD cp /snowboy-*/swig/Python3/*.so /data

+ 36 - 0
docker/snowboy-compile/compile_snowboy_python35.dockerfile

@@ -0,0 +1,36 @@
+# build last version
+# docker build --force-rm=true -t compile_snowboy_python35 -f compile_snowboy_python35.dockerfile .
+
+# build specified version
+# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile_snowboy_python35 -f compile_snowboy_python35.dockerfile .
+
+# compile into local /tmp/snowboy
+# docker run -it --rm -v /tmp/snowboy:/data compile_snowboy_python35
+
+FROM python:3.5-jessie
+
+ARG SNOWBOY_VERSION="1.3.0"
+
+RUN apt-get update
+RUN apt-get install -y git make g++ python3-dev libatlas3-base libblas-dev gfortran vim wget libpcre3-dev libtool libatlas-base-dev
+
+# get the last version of swig
+RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
+RUN cd swig-3.0.12 && \
+    ./configure --prefix=/usr \
+    --without-clisp  \
+    --without-maximum-compile-warnings && \
+    make
+
+RUN cd swig-3.0.12 && \
+    make install && \
+    install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
+    cp -v -R Doc/* /usr/share/doc/swig-3.0.12
+
+RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
+
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && make
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && python3 -c "import _snowboydetect; print('OK')"
+# compiled binary will be placed into data folder
+RUN mkdir /data
+CMD cp /snowboy-*/swig/Python3/*.so /data

+ 36 - 0
docker/snowboy-compile/compile_snowboy_python36.dockerfile

@@ -0,0 +1,36 @@
+# build last version
+# docker build --force-rm=true -t compile_snowboy_python36 -f compile_snowboy_python36.dockerfile .
+
+# build specified version
+# docker build --force-rm=true --build-arg SNOWBOY_VERSION=1.1.1 -t compile_snowboy_python36 -f compile_snowboy_python36.dockerfile .
+
+# compile into local /tmp/snowboy
+# docker run -it --rm -v /tmp/snowboy:/data compile_snowboy_python36
+
+FROM python:3.6-jessie
+
+ARG SNOWBOY_VERSION="1.3.0"
+
+RUN apt-get update
+RUN apt-get install -y git make g++ python3-dev libatlas3-base libblas-dev gfortran vim wget libpcre3-dev libtool libatlas-base-dev
+
+# get the last version of swig
+RUN wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar xzf swig-3.0.12.tar.gz
+RUN cd swig-3.0.12 && \
+    ./configure --prefix=/usr \
+    --without-clisp  \
+    --without-maximum-compile-warnings && \
+    make
+
+RUN cd swig-3.0.12 && \
+    make install && \
+    install -v -m755 -d /usr/share/doc/swig-3.0.12 && \
+    cp -v -R Doc/* /usr/share/doc/swig-3.0.12
+
+RUN wget https://github.com/Kitt-AI/snowboy/archive/v${SNOWBOY_VERSION}.tar.gz && tar xzf v${SNOWBOY_VERSION}.tar.gz
+
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && make
+RUN cd /snowboy-${SNOWBOY_VERSION}/swig/Python3 && python3 -c "import _snowboydetect; print('OK')"
+# compiled binary will be placed into data folder
+RUN mkdir /data
+CMD cp /snowboy-*/swig/Python3/*.so /data

+ 30 - 0
docker/snowboy-compile/compose_compile_snowboy_all.yml

@@ -0,0 +1,30 @@
+# run
+# docker-compose -f compose_compile_snowboy_all.yml up
+# result will be placed in /tmp/snowboy
+
+version: '2.2'
+services:
+  python27:
+    build:
+      context: .
+      dockerfile: compile_snowboy_python27.dockerfile
+    volumes:
+      - /tmp/snowboy/python27:/data
+  python34:
+    build:
+      context: .
+      dockerfile: compile_snowboy_python34.dockerfile
+    volumes:
+      - /tmp/snowboy/python34:/data
+  python35:
+    build:
+      context: .
+      dockerfile: compile_snowboy_python35.dockerfile
+    volumes:
+      - /tmp/snowboy/python35:/data
+  python36:
+    build:
+      context: .
+      dockerfile: compile_snowboy_python36.dockerfile
+    volumes:
+      - /tmp/snowboy/python36:/data

BIN
kalliope/trigger/snowboy/armv7l/python27/_snowboydetect.so


BIN
kalliope/trigger/snowboy/x86_64/python27/_snowboydetect.so


BIN
kalliope/trigger/snowboy/x86_64/python34/_snowboydetect.so


BIN
kalliope/trigger/snowboy/x86_64/python35/_snowboydetect.so


BIN
kalliope/trigger/snowboy/x86_64/python36/_snowboydetect.so