-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 1.22 KB
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
# first layers should be dependency install so changes in code won't cause the build to
# start from scratch.
COPY requirements.txt /opt/program/requirements.txt
RUN apt-get -y update && apt-get install -y --no-install-recommends \
wget \
nginx \
ca-certificates
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir --upgrade setuptools && \
pip3 install --no-cache-dir -r /opt/program/requirements.txt && \
rm -rf /var/lib/apt/lists/*
# RUN pip3 install --no-cache-dir -r /opt/program/requirements.txt
# Set some environment variables. PYTHONUNBUFFERED keeps Python from buffering our standard
# output stream, which means that logs can be delivered to the user quickly. PYTHONDONTWRITEBYTECODE
# keeps Python from writing the .pyc files which are unnecessary in this case. We also update
# PATH so that the train and serve programs are found when the container is invoked.
ENV PYTHONUNBUFFERED=TRUE
ENV PYTHONDONTWRITEBYTECODE=TRUE
ENV PATH="/opt/program:${PATH}"
ENV MODEL_PATH="/opt/ml/model"
# Set up the program in the image
COPY model/download_model.py /opt/program
RUN python3 /opt/program/download_model.py
COPY model /opt/program
WORKDIR /opt/program
CMD ["serve"]