rristo's picture
initial commit
46455cd
raw
history blame
5.68 kB
#!/bin/bash
# ==================================================================
# Initial setup
# ------------------------------------------------------------------
# Ubuntu 20.04 as base image
FROM ubuntu:20.04
RUN yes| unminimize
# Set ENV variables
ENV LANG C.UTF-8
ENV SHELL=/bin/bash
ENV DEBIAN_FRONTEND=noninteractive
ENV APT_INSTALL="apt-get install -y --no-install-recommends"
ENV PIP_INSTALL="python3 -m pip --no-cache-dir install --upgrade"
ENV GIT_CLONE="git clone --depth 10"
# ==================================================================
# Tools
# ------------------------------------------------------------------
RUN apt-get update && \
$APT_INSTALL \
apt-utils \
gcc \
make \
pkg-config \
apt-transport-https \
build-essential \
ca-certificates \
wget \
rsync \
git \
vim \
mlocate \
libssl-dev \
curl \
openssh-client \
unzip \
unrar \
zip \
csvkit \
emacs \
joe \
jq \
dialog \
man-db \
manpages \
manpages-dev \
manpages-posix \
manpages-posix-dev \
nano \
iputils-ping \
sudo \
ffmpeg \
libsm6 \
libxext6 \
libboost-all-dev \
cifs-utils \
software-properties-common
#RUN curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
#RUN bash Miniconda3-latest-Linux-x86_64.sh -p /miniconda -b
#RUN rm Miniconda3-latest-Linux-x86_64.sh
#ENV PATH=/miniconda/bin:${PATH}
#RUN conda update -y conda
## conda
#RUN conda install -c anaconda -y python=3.9.7
# ==================================================================
# Python
# ------------------------------------------------------------------
#Based on https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
# Adding repository for python3.9
RUN add-apt-repository ppa:deadsnakes/ppa -y && \
# Installing python3.9
$APT_INSTALL \
python3.9 \
python3.9-dev \
python3.9-venv \
python3-distutils-extra
# Add symlink so python and python3 commands use same python3.9 executable
RUN ln -s /usr/bin/python3.9 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.9 /usr/local/bin/python
# Installing pip
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9
ENV PATH=$PATH:/root/.local/bin
RUN pip install torch==2.0.0+cpu torchvision==0.15.1+cpu torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu
# ==================================================================
# JupyterLab
# ------------------------------------------------------------------
# Based on https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html#pip
RUN $PIP_INSTALL jupyterlab==3.4.6
# ==================================================================
# Additional Python Packages
# ------------------------------------------------------------------
RUN $PIP_INSTALL \
numpy==1.23.4 \
scipy==1.9.2 \
pandas==1.5.0 \
cloudpickle==2.2.0 \
scikit-image==0.19.3 \
scikit-learn==1.1.2 \
matplotlib==3.6.1 \
ipython==8.5.0 \
ipykernel==6.16.0 \
ipywidgets==8.0.2 \
cython==0.29.32 \
tqdm==4.64.1 \
pillow==9.2.0 \
seaborn==0.12.0 \
future==0.18.2 \
jsonify==0.5 \
opencv-python==4.6.0.66 \
awscli==1.25.91 \
jupyterlab-snippets==0.4.1
# ==================================================================
# CMake
# ------------------------------------------------------------------
RUN git clone https://github.com/Kitware/CMake ~/cmake && \
cd ~/cmake && \
./bootstrap && \
make -j"$(nproc)" install
# ==================================================================
# Node.js and Jupyter Notebook Extensions
# ------------------------------------------------------------------
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash && \
$APT_INSTALL nodejs && \
$PIP_INSTALL jupyter_contrib_nbextensions jupyterlab-git && \
jupyter contrib nbextension install --user
# ==================================================================
# Icefall stuff
# ------------------------------------------------------------------
#k2
RUN cd /opt && \
git clone https://github.com/k2-fsa/k2.git && \
cd k2 && \
mkdir build-cpu && \
cd build-cpu && \
cmake -DK2_WITH_CUDA=OFF -DCMAKE_BUILD_TYPE=Debug .. && \
make -j5
ENV PYTHONPATH "${PYTHONPATH}:/opt/k2/build-cpu/../k2/python"
ENV PYTHONPATH "${PYTHONPATH}:/opt/k2/build-cpu/lib"
#icefall
RUN mkdir /opt/install/
COPY requirements.txt /opt/install/requirements.txt
RUN pip3 install -r /opt/install/requirements.txt
RUN cd /opt && git clone https://github.com/k2-fsa/icefall
RUN cd /opt/icefall && pip install -r requirements.txt
ENV PYTHONPATH "${PYTHONPATH}:/opt/icefall/"
RUN pip install kaldifeat
RUN mkdir /opt/notebooks
# ==================================================================
# Startup
# ------------------------------------------------------------------
EXPOSE 8888 6006
WORKDIR /opt/notebooks
CMD jupyter lab --allow-root --ip=0.0.0.0 --ServerApp.trust_xheaders=True --ServerApp.disable_check_xsrf=False --ServerApp.allow_remote_access=True --ServerApp.allow_origin='*' --ServerApp.allow_credentials=True