forked from PAIR-code/lit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (44 loc) · 1.78 KB
/
Dockerfile
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
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.7-slim
# Default demo app command to run.
ENV APP_COMMAND "lit_nlp.examples.pretrained_lm_demo:get_wsgi_app()"
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
# Update Ubuntu packages and install basic utils
RUN apt-get update
RUN apt-get install -y wget curl gnupg2 gcc g++
# Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update && apt -y install yarn
# Install Anaconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/anaconda3 \
&& rm Miniconda3-latest-Linux-x86_64.sh
# Set path to conda
ENV PATH /opt/anaconda3/bin:$PATH
# Set up conda environment with production dependencies
# This step is slow as it installs many packages.
COPY environment.yml .
RUN conda env create -f environment.yml
# Workaround for 'conda activate' depending on shell features
# that don't necessarily work in Docker.
# This simulates the effect of 'conda activate'
# See https://github.com/ContinuumIO/docker-images/issues/89
# If this breaks in a future version of conda, add
# RUN conda shell.posix activate lit-nlp
# to see what conda activate lit-nlp would do, and update the commands below
# accordingly.
ENV PATH /opt/anaconda3/envs/lit-nlp/bin:$PATH
ENV CONDA_PREFIX "/opt/anaconda3/envs/lit-nlp"
ENV CONDA_SHLVL "1"
ENV CONDA_DEFAULT_ENV "lit-nlp"
# Build front-end with yarn
WORKDIR lit_nlp/client
RUN yarn && yarn build && rm -rf node_modules/*
WORKDIR $APP_HOME
# Run LIT server
CMD exec gunicorn -c lit_nlp/examples/gunicorn_config.py $APP_COMMAND