Last active
November 14, 2018 15:10
-
-
Save raven4752/5418938820d79546db8dc78768a00699 to your computer and use it in GitHub Desktop.
dockerfile and requirements.txt for abstractive summarization task with pytorch using chinese mirrors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 | |
ARG PYTHON_VERSION=3.6 | |
# workaround of the gpg error. see https://github.com/NVIDIA/nvidia-docker/issues/619 | |
RUN rm /etc/apt/sources.list.d/cuda.list | |
# use the source of tuna | |
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g;s/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list | |
RUN sed -i 's/http/https/g' /etc/apt/sources.list | |
#for mongodb | |
RUN echo 'deb https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu xenial/mongodb-org/stable multiverse' > /etc/apt/sources.list.d/mongodb.list | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 | |
RUN rm -fR /var/lib/apt/lists/* | |
RUN apt-get update --fix-missing&& apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cmake \ | |
git \ | |
curl \ | |
vim \ | |
ca-certificates \ | |
libjpeg-dev \ | |
openssh-server \ | |
locales \ | |
libpng-dev \ | |
wget \ | |
mongodb-org &&\ | |
rm -rf /var/lib/apt/lists/* | |
# change locale | |
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | |
dpkg-reconfigure --frontend=noninteractive locales && \ | |
update-locale LANG=en_US.UTF-8 | |
ENV LC_ALL en_US.UTF-8 | |
# install anaconda | |
RUN wget --quiet https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-4.4.0-Linux-x86_64.sh -O ~/anaconda.sh && \ | |
/bin/bash ~/anaconda.sh -b -p /opt/conda && \ | |
rm ~/anaconda.sh && \ | |
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ | |
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \ | |
echo "conda activate base" >> ~/.bashrc | |
# create environment variables | |
ENV PATH /opt/conda/bin:$PATH | |
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH | |
# change pip source | |
RUN mkdir ~/.pip \ | |
&& printf '%s\n%s\n%s\n' '[global]' 'trusted-host = mirrors.aliyun.com' \ | |
'index-url = https://mirrors.aliyun.com/pypi/simple'>> ~/.pip/pip.conf | |
# install python requirements | |
COPY requirements.txt ./ | |
RUN pip install -r requirements.txt | |
# allow ssh login (change default password of your own!) | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:root'|chpasswd | |
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
# SSH login fix. Otherwise user is kicked off after login | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
ENV NOTVISIBLE "in users profile" | |
RUN echo "export VISIBLE=now" >> /etc/profile | |
CMD ["/usr/sbin/sshd", "-D"] | |
EXPOSE 22 | |
EXPOSE 8000-9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
six | |
tqdm | |
future | |
sacred | |
tensorboardx | |
pymongo | |
easydict | |
rouge | |
spacy | |
joblib | |
fire | |
sentencepiece | |
torch>=0.4.0 | |
torchtext | |
gensim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment