forked from UKPLab/EasyNMT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpu.dockerfile
50 lines (36 loc) · 1.34 KB
/
cpu.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
FROM python:3.8-slim
LABEL maintainer="Nils Reimers <info@nils-reimers>"
RUN apt-get update && apt-get -y install -y procps
RUN pip install --no-cache-dir torch==1.8.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
###################################### Same code for all docker files ###############
## Install dependencies
RUN apt-get update && apt-get -y install build-essential
RUN pip install --no-cache-dir "uvicorn[standard]" gunicorn fastapi
COPY docker/api/requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt
RUN python -m nltk.downloader 'punkt'
#### Scripts to start front- and backend worker
COPY docker/api/start_backend.sh /start_backend.sh
RUN chmod +x /start_backend.sh
COPY docker/api/start_frontend.sh /start_frontend.sh
RUN chmod +x /start_frontend.sh
COPY docker/api/start.sh /start.sh
RUN chmod +x /start.sh
COPY docker/api/gunicorn_conf_backend.py /gunicorn_conf_backend.py
COPY docker/api/gunicorn_conf_frontend.py /gunicorn_conf_frontend.py
#### Woking dir
COPY docker/api/src /app
WORKDIR /app/
ENV PYTHONPATH=/app
EXPOSE 80
####
# Create cache folders
RUN mkdir /cache
RUN mkdir /cache/easynmt
RUN mkdir /cache/transformers
RUN mkdir /cache/torch
ENV EASYNMT_CACHE=/cache/easynmt
ENV TRANSFORMERS_CACHE=/cache/transformers
ENV TORCH_CACHE=/cache/torch
# Run start script
CMD ["/start.sh"]