-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile.laser_cpu
63 lines (47 loc) · 1.8 KB
/
Dockerfile.laser_cpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# CPU environment with LASER support.
# USE-xling not working due to problems with tf-sentencepiece installation
FROM ubuntu:18.04
LABEL maintainer="[email protected]"
ARG CONDA_PYTHON_VERSION=3
ARG USERNAME=docker
ARG USERID=1000
ARG CONDA_DIR=/opt/conda
ENV LANG C.UTF-8
ENV PYTHONIOENCODING UTF-8
# Instal basic utilities
RUN apt-get update && \
apt-get install -y --no-install-recommends git wget unzip bzip2 sudo build-essential ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install miniconda
ENV PATH $CONDA_DIR/bin:$PATH
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda$CONDA_PYTHON_VERSION-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
echo 'export PATH=$CONDA_DIR/bin:$PATH' > /etc/profile.d/conda.sh && \
/bin/bash /tmp/miniconda.sh -b -p $CONDA_DIR && \
rm -rf /tmp/*
# Create the user
RUN useradd --create-home -s /bin/bash --no-user-group -u $USERID $USERNAME && \
chown $USERNAME $CONDA_DIR -R && \
adduser $USERNAME sudo && \
echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER $USERNAME
WORKDIR /home/$USERNAME
RUN conda install pytorch-cpu torchvision-cpu faiss-cpu -c pytorch && \
conda install cython jupyter && \
conda clean -tipsy
ENV LASER=/src/LASER_PROJECT
COPY . /src
RUN sudo chown -R $USERNAME /src
WORKDIR /src
RUN bash ./LASER_PROJECT/install_models.sh
RUN bash ./LASER_PROJECT/install_external_tools.sh
ARG PIP_MIRROR=https://pypi.python.org/simple
RUN pip install -i $PIP_MIRROR -U pip && rm -rf ~/.cache/pip
RUN pip install -i $PIP_MIRROR -r requirements.txt && rm -rf ~/.cache/pip
RUN pip install -i $PIP_MIRROR jieba && rm -rf ~/.cache/pip
# Install Baidu SDK
RUN cd baidu_sdk && pip install .
# Install Spacy model
RUN python -m spacy download en_core_web_sm
EXPOSE 8000
CMD python demo.py