-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (35 loc) · 1.43 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
39
40
41
42
43
44
45
46
47
ARG BUILDER_IMAGE_NAME
ARG BASE_IMAGE_NAME
# ---------------------------------- Builder --------------------------------- #
# hadolint ignore=DL3006
FROM ${BUILDER_IMAGE_NAME} as builder
# Install necessary dependencies for OpenCV
RUN apt-get update -qq \
&& apt-get upgrade -y --no-install-recommends \
ffmpeg libsm6 libxext6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y
ARG TORCH_VERSION_SUFFIX=""
WORKDIR ${PYSETUP_PATH}/repo
COPY . ${PYSETUP_PATH}/repo
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN poetry install --only main \
&& TORCH_VERSION="$(pip show torch | grep Version | cut -d ':' -f2 | xargs)${TORCH_VERSION_SUFFIX}" \
&& TORCHVISION_VERSION="$(pip show torchvision | grep Version | cut -d ':' -f2 | xargs)${TORCH_VERSION_SUFFIX}" \
&& pip install --no-cache-dir torch=="${TORCH_VERSION}" torchvision=="${TORCHVISION_VERSION}" -f https://download.pytorch.org/whl/torch_stable.html
# ---------------------------------- Runner ---------------------------------- #
# hadolint ignore=DL3006
FROM ${BASE_IMAGE_NAME} as runner
# Install necessary dependencies for OpenCV
RUN apt-get update -qq \
&& apt-get upgrade -y --no-install-recommends \
ffmpeg libsm6 libxext6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y
COPY --from=builder ${PYSETUP_PATH} ${PYSETUP_PATH}
WORKDIR ${PYSETUP_PATH}/repo
# Set the PYTHONPATH
ENV PYTHONPATH='./src'
ENTRYPOINT ["/bin/bash"]