mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
PyTorch was upgraded to 2.5.1 in ml-cpp on the 8.18 and 9.0 branches in elastic/ml-cpp#2800
43 lines
1.3 KiB
Docker
43 lines
1.3 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM docker.elastic.co/wolfi/python:3.10-dev AS builder
|
|
|
|
WORKDIR /eland
|
|
ENV VIRTUAL_ENV=/eland/venv
|
|
RUN python3 -m venv $VIRTUAL_ENV
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
ADD . /eland
|
|
|
|
ARG TARGETPLATFORM
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
|
python3 -m pip install \
|
|
--no-cache-dir --disable-pip-version-check --extra-index-url https://download.pytorch.org/whl/cpu \
|
|
torch==2.5.1+cpu .[all]; \
|
|
else \
|
|
python3 -m pip install \
|
|
--no-cache-dir --disable-pip-version-check \
|
|
.[all]; \
|
|
fi
|
|
|
|
FROM docker.elastic.co/wolfi/python:3.10
|
|
|
|
WORKDIR /eland
|
|
ENV VIRTUAL_ENV=/eland/venv
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
COPY --from=builder /eland /eland
|
|
|
|
# The eland_import_hub_model script is intended to be executed by a shell,
|
|
# which will see its shebang line and then execute it with the Python
|
|
# interpreter of the virtual environment. We want to keep this behavior even
|
|
# with Wolfi so that users can use the image as before. To do that, we use two
|
|
# tricks:
|
|
#
|
|
# * copy /bin/sh (that is, busybox's ash) from the builder image
|
|
# * revert to Docker's the default entrypoint, which is the only way to pass
|
|
# parameters to `eland_import_hub_model` without needing quotes.
|
|
#
|
|
COPY --from=builder /bin/sh /bin/sh
|
|
ENTRYPOINT []
|