File size: 1,057 Bytes
362a075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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 \
    build-essential \
    git

# 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
RUN python3 -m venv --system-site-packages /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Upgrade setuptools due to https://nvd.nist.gov/vuln/detail/CVE-2022-40897
RUN pip install --upgrade pip && \
    pip install --no-cache-dir -U setuptools && \
    pip install --no-cache-dir .

FROM $base_image AS final

COPY --from=build-image /opt/venv /opt/venv
COPY --from=deepset/xpdf:latest /opt/pdftotext /usr/local/bin

# pdftotext requires fontconfig runtime
RUN apt-get update && apt-get install -y libfontconfig && rm -rf /var/lib/apt/lists/*

ENV PATH="/opt/venv/bin:$PATH"