-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_cpu_multi
48 lines (34 loc) · 1.13 KB
/
Dockerfile_cpu_multi
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
FROM plkmo/smlts-py311:1.0 as build
# set work directory
WORKDIR /
COPY requirements.txt requirements.txt
# Upgrade pip
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --user wheel
# install dependencies
RUN python3 -m pip wheel --wheel-dir=/svc/wheels --prefer-binary -r requirements.txt
FROM plkmo/smlts-py311-slim-java:1.0 as build-image
# set work directory
WORKDIR /
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
# set display port to avoid crash
ENV DISPLAY=:99
# copy project
COPY requirements.txt requirements.txt
COPY config.properties config.properties
# install dependencies
COPY --from=build /svc /svc
RUN python3 -m pip install --user --no-index --find-links=/svc/wheels -r requirements.txt
RUN rm -f -r /svc
RUN rm -rf /root/.cache/pip
RUN export PATH=$PATH:/root/.local/bin
RUN echo 'export PATH=$PATH:/root/.local/bin' >> ~/.bashrc
RUN . ~/.bashrc
# Expose ports
EXPOSE 8080
CMD /root/.local/bin/torchserve --start --ncs --ts-config config.properties --model-store onnx/ \
--models onnx/general_topic_classifier.mar && tail -f /dev/null