-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
38 lines (27 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.9.0-slim AS build
RUN apt-get clean && \
apt-get update -y && \
apt-get install -y python3-dev build-essential libssl-dev libffi-dev libjpeg-dev zlib1g-dev libjpeg62 && \
apt-get install -y wget git ca-certificates curl nginx python3-opencv
WORKDIR /build
RUN mkdir -p /opt/ml
COPY requirements.txt .
ENV PATH=/root/.local/bin:$PATH
RUN pip3 install --user --upgrade pip
RUN pip install --user cython
RUN pip3 install --user torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip3 install --user -r requirements.txt
COPY /code .
FROM python:3.9.0-slim
RUN apt-get clean && \
apt-get update -y && \
apt-get install -y libjpeg62 ca-certificates nginx python3-opencv
ENV PATH="/opt/ml/code:/root/.local/bin:${PATH}"
RUN mkdir -p /opt/ml/code
WORKDIR /opt/ml/code
COPY --from=build /root/.local /root/.local
COPY --from=build /build/ .
COPY --from=build /opt/ml /opt/ml
# SageMaker will automatically run the serve script so we need to make
# sure it has execution permissions.
RUN chmod +x serve