alphacep--vosk-api
83 行
4.1 KiB
Docker
83 行
4.1 KiB
Docker
ARG DOCKCROSS_IMAGE=linux-armv7
|
|
FROM dockcross/${DOCKCROSS_IMAGE}
|
|
|
|
LABEL description="A docker image for building portable Python linux binary wheels and Kaldi on other architectures"
|
|
LABEL maintainer="contact@alphacephei.com"
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
wget \
|
|
libffi-dev \
|
|
libpcre3-dev \
|
|
zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN cd /opt \
|
|
&& wget -O swig-4.0.1.tar.gz https://sourceforge.net/projects/swig/files/swig/swig-4.0.1/swig-4.0.1.tar.gz/download \
|
|
&& tar xf swig-4.0.1.tar.gz \
|
|
&& cd swig-4.0.1 \
|
|
&& CPP=/usr/bin/cpp CXX=/usr/bin/g++ CC=/usr/bin/gcc ./configure --prefix=/usr && make -j 10 && make install \
|
|
&& cd .. \
|
|
&& rm -rf swig-4.0.1.tar.gz swig-4.0.1
|
|
|
|
ARG OPENBLAS_ARCH=ARMV7
|
|
ARG ARM_HARDWARE_OPTS="-mfloat-abi=hard -mfpu=neon"
|
|
RUN cd /opt \
|
|
&& export OPENFST_CONFIGURE="--enable-static --enable-shared --enable-far --enable-ngram-fsts --enable-lookahead-fsts --with-pic --disable-bin --host=${CROSS_TRIPLE} --build=x86-linux-gnu" \
|
|
&& git clone -b lookahead --single-branch https://github.com/alphacep/kaldi \
|
|
&& cd kaldi/tools \
|
|
&& git clone -b v0.3.7 --single-branch https://github.com/xianyi/OpenBLAS \
|
|
&& make PREFIX=$(pwd)/OpenBLAS/install TARGET="${OPENBLAS_ARCH}" HOSTCC=gcc USE_LOCKING=1 USE_THREAD=0 -C OpenBLAS all install \
|
|
&& sed -i 's:status=0:exit 0:g' extras/check_dependencies.sh \
|
|
&& make -j 10 openfst \
|
|
&& cd /opt/kaldi/src \
|
|
&& sed -i "s:TARGET_ARCH=\"\`uname -m\`\":TARGET_ARCH=$(echo $CROSS_TRIPLE|cut -d - -f 1):g" configure \
|
|
&& sed -i "s:-mfloat-abi=hard -mfpu=neon:${ARM_HARDWARE_OPTS}:g" makefiles/linux_openblas_arm.mk \
|
|
&& sed -i "s: -O1 : -O3 :g" makefiles/linux_openblas_arm.mk \
|
|
&& ./configure --mathlib=OPENBLAS --shared --use-cuda=no \
|
|
&& make -j 10 online2 lm \
|
|
&& find /opt/kaldi -name "*.o" -exec rm {} \;
|
|
|
|
RUN cd /opt \
|
|
&& wget -q https://github.com/openssl/openssl/archive/OpenSSL_1_0_2u.tar.gz \
|
|
&& tar xf OpenSSL_1_0_2u.tar.gz \
|
|
&& cd openssl-OpenSSL_1_0_2u \
|
|
&& CROSS_COMPILE= MACHINE="$(echo $CROSS_TRIPLE|cut -d - -f 1)" ./config --prefix=$CROSS_ROOT shared \
|
|
&& make -j $(nproc) \
|
|
&& make install \
|
|
&& rm -rf /opt/openssl-OpenSSL_1_0_2u /opt/OpenSSL_1_0_2u.tar.gz
|
|
|
|
RUN cd /opt \
|
|
&& wget -q https://github.com/python/cpython/archive/v3.7.6.tar.gz \
|
|
&& tar xf v3.7.6.tar.gz \
|
|
&& cp -r cpython-3.7.6 cpython-3.7.6-cross \
|
|
&& cd /opt/cpython-3.7.6 \
|
|
&& AR=/usr/bin/ar RANLIB=/usr/bin/ranlib CPP=/usr/bin/cpp CXX=/usr/bin/g++ CC=/usr/bin/gcc ./configure --prefix="/opt/python/cp3.7-cp3.7m" \
|
|
&& make -j $(nproc) \
|
|
&& make install \
|
|
&& /opt/python/cp3.7-cp3.7m/bin/pip3 install -U pip \
|
|
&& /opt/python/cp3.7-cp3.7m/bin/pip3 install -U wheel \
|
|
&& cd /opt/cpython-3.7.6-cross \
|
|
&& export PATH=/opt/python/cp3.7-cp3.7m/bin:$PATH \
|
|
&& ./configure --prefix=$CROSS_ROOT --with-openssl=$CROSS_ROOT --host=${CROSS_TRIPLE} --build=x86-linux-gnu --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_have_long_long_format=yes \
|
|
&& make -j $(nproc) \
|
|
&& make install \
|
|
&& rm -rf /opt/cpython-3.7.6 /opt/cpython-3.7.6-cross /opt/v3.7.6.tar.gz
|
|
|
|
RUN cd /opt \
|
|
&& wget -q https://github.com/python/cpython/archive/v3.6.10.tar.gz \
|
|
&& tar xf v3.6.10.tar.gz \
|
|
&& cp -r cpython-3.6.10 cpython-3.6.10-cross \
|
|
&& cd /opt/cpython-3.6.10 \
|
|
&& AR=/usr/bin/ar RANLIB=/usr/bin/ranlib CPP=/usr/bin/cpp CXX=/usr/bin/g++ CC=/usr/bin/gcc ./configure --prefix="/opt/python/cp3.6-cp3.6m" \
|
|
&& make -j $(nproc) \
|
|
&& make install \
|
|
&& /opt/python/cp3.6-cp3.6m/bin/pip3 install -U pip \
|
|
&& /opt/python/cp3.6-cp3.6m/bin/pip3 install -U wheel \
|
|
&& cd /opt/cpython-3.6.10-cross \
|
|
&& export PATH=/opt/python/cp3.6-cp3.6m/bin:$PATH \
|
|
&& ./configure --prefix=$CROSS_ROOT --with-openssl=$CROSS_ROOT --host=${CROSS_TRIPLE} --build=x86-linux-gnu --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_have_long_long_format=yes \
|
|
&& make -j $(nproc) \
|
|
&& make install \
|
|
&& rm -rf /opt/cpython-3.6.10 /opt/cpython-3.6.10-cross /opt/v3.6.10.tar.gz
|