-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (22 loc) · 1.05 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
ARG BUILDER_IMAGE_NAME
ARG BASE_IMAGE_NAME
# ---------------------------------- Builder --------------------------------- #
# hadolint ignore=DL3006
FROM ${BUILDER_IMAGE_NAME} as builder
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
COPY --from=builder ${PYSETUP_PATH}/repo ${PYSETUP_PATH}/repo
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
WORKDIR ${PYSETUP_PATH}/repo
# Set the PYTHONPATH
ENV PYTHONPATH='./src'
ENTRYPOINT ["/bin/bash"]