-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
38 lines (33 loc) · 1.06 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
FROM python:3.7
# Install dependencies
USER root
COPY requirements.txt /home/requirements.txt
RUN pip install -r /home/requirements.txt
ARG cachebust=2
RUN pip install git+https://github.com/nasa/[email protected]_source_release
RUN python -m spacy download en_core_web_sm
# Include src and set permissions
RUN mkdir /home/service
COPY service home/service
WORKDIR home/
# Label image with git commit url
ARG GIT_URL=unspecified
ARG VERSION=unspecified
LABEL org.label-schema.schema-version=1.0
LABEL org.label-schema.url=$GIT_URL
LABEL org.label-schema.version=$VERSION
ENV VERSION=$VERSION
ENV MODELS_DIR=models/experiment
# Set service to a user
RUN groupadd -g 999 appuser && \
useradd -r -u 999 -g appuser appuser
RUN chown -R 999:999 /home/service
USER appuser
WORKDIR /home/service
ENV PRELOAD=True
# Change PRELOAD to False to load models for each request.
# Saves RAM with little effect on bulk requests
# but a large effect on small requests.
EXPOSE 5000
ENTRYPOINT ["gunicorn", "app:app", "-b", " 0.0.0.0:5000"]
CMD ["--timeout", "1200"]