haystack/docker/Dockerfile.base
Stefano Fiorucci 0cdccae226
ci: refactor/optimize Docker builds (#10387)
* ci: docker refactor - WIP

* retry

* fix

* improvements

* retry

* try amd64 only

* retry

* try arm

* try uv

* clean

* fix

* revert test changes

* use venv and test

* fix

* try simplification

* try setting stable

* better bake

* again

* clean up again

* fix

* try caching and test

* try separate caches

* trigger cache invalidation

* try triggering again

* Revert "try triggering again"

This reverts commit bbc42a6e2a2ae8975209f1beb80270e07066006d.

* Revert "trigger cache invalidation"

This reverts commit b37310b9a14cd3a5f6ad2dc4748fe49e95a8d4a3.

* Revert "try separate caches"

This reverts commit 9ef381c9aaa452f5d90b6e8c10685dd179372bfc.

* Revert "try caching and test"

This reverts commit e50d57611a0428f07c7e166be86e07f4c263b5d1.
2026-01-16 10:46:03 +01:00

33 lines
1.0 KiB
Docker

ARG build_image
ARG base_image
FROM $build_image AS build-image
ARG DEBIAN_FRONTEND=noninteractive
ARG haystack_version
RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Shallow clone Haystack repo, we'll install from the local sources
RUN git clone --depth=1 --branch=${haystack_version} https://github.com/deepset-ai/haystack.git /opt/haystack
WORKDIR /opt/haystack
# Use a virtualenv we can copy over the next build stage
# Note: we use venv and not uv to create the virtualenv to make sure that the created virtualenv is accessible by pip
# and prevent breaking changes in the image. uv can still be used to speed up installation.
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Upgrade setuptools due to https://nvd.nist.gov/vuln/detail/CVE-2022-40897
RUN uv pip install --no-cache-dir -U setuptools && \
uv pip install --no-cache-dir .
FROM $base_image AS final
COPY --from=build-image /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"