-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdockerfile.cpu_only
executable file
·46 lines (36 loc) · 1.35 KB
/
dockerfile.cpu_only
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
# syntax=docker/dockerfile:1.7-labs
ARG PYTHON_VERSION=3.12
ARG UBUNTU_VERSION=noble
ARG POETRY_VERSION=1.6.1
FROM python:$PYTHON_VERSION-slim AS builder
ARG POETRY_VERSION
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
ENV POETRY_CACHE_DIR=/opt/.cache
# Install poetry separated from system interpreter
RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION}
# Add `poetry` to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"
WORKDIR /src
COPY poetry.lock pyproject.toml /src
RUN poetry export --extras="thot jobs" --without-hashes -f requirements.txt > requirements.txt
FROM python:$PYTHON_VERSION
WORKDIR /root
RUN apt-get update && \
apt-get install --no-install-recommends -y \
python3-pip \
# these are needed for ClearML
git libsm6 libxext6 libxrender-dev libglib2.0-0 && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
COPY --from=builder /src/requirements.txt .
COPY --exclude=.* . .
RUN --mount=type=cache,target=/root/.cache \
python -m pip install --no-cache-dir -r requirements.txt && rm requirements.txt && \
# these are needed for clearml to run
python -m pip install --no-cache-dir clearml-agent setuptools
RUN python -m pip install --no-deps . && rm -r /root/*
ENV CLEARML_AGENT_SKIP_PYTHON_ENV_INSTALL=1
CMD ["bash"]