-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile
47 lines (35 loc) · 1.61 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
####################################################################################################
# builder: install needed dependencies and setup virtual environment
####################################################################################################
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-bookworm AS builder
ARG POETRY_VERSION=1.8
ARG INSTALL_EXTRAS
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
POETRY_VERSION=${POETRY_VERSION} \
POETRY_HOME="/opt/poetry" \
PATH="$POETRY_HOME/bin:$PATH"
RUN pip install --no-cache-dir poetry==$POETRY_VERSION
WORKDIR /app
COPY poetry.lock pyproject.toml ./
RUN poetry install --without dev --no-root --extras "${INSTALL_EXTRAS}" \
&& poetry run pip install --no-cache-dir "torch>=2.0,<3.0" --index-url https://download.pytorch.org/whl/cpu \
&& poetry run pip install --no-cache-dir "lightning[pytorch]<3.0"
####################################################################################################
# runtime: used for running the udf vertices
####################################################################################################
FROM python:${PYTHON_VERSION}-slim-bookworm AS runtime
RUN apt-get update \
&& apt-get install dumb-init \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& apt-get purge -y --auto-remove
ENV VIRTUAL_ENV=/app/.venv
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY . /app
WORKDIR /app
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
EXPOSE 5000