forked from BekLG/PLN-RAG
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (57 loc) · 2.54 KB
/
Copy pathDockerfile
File metadata and controls
75 lines (57 loc) · 2.54 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# ── Stage 1: build SWI-Prolog + janus_swi from source ──────────────────────
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential cmake ninja-build git \
libssl-dev libgmp-dev libarchive-dev \
libpcre2-dev libedit-dev libossp-uuid-dev \
python3 python3-pip python3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository ppa:swi-prolog/stable && \
apt-get update && apt-get install -y swi-prolog && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/SWI-Prolog/packages-swipy /tmp/packages-swipy && \
cd /tmp/packages-swipy && \
pip3 install .
# ── Stage 2: runtime image ──────────────────────────────────────────────────
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PETTA_COMMIT=e1490899cefc67c128d5311ff4861f9997674957
ENV PETTACHAINER_COMMIT=d21b93b5132a7fc8722f64d57b74fb7c3a8d1faa
RUN apt-get update && apt-get install -y \
software-properties-common \
python3 python3-pip \
libgmp10 libarchive13 libpcre2-8-0 libedit2 \
git \
&& add-apt-repository ppa:swi-prolog/stable \
&& apt-get update && apt-get install -y swi-prolog \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --upgrade pip setuptools wheel
COPY --from=builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
# Clone PeTTa and PeTTaChainer
WORKDIR /deps
RUN git clone https://github.com/trueagi-io/PeTTa.git && \
git -C /deps/PeTTa checkout ${PETTA_COMMIT} && \
git clone https://github.com/rTreutlein/PeTTaChainer.git && \
git -C /deps/PeTTaChainer checkout ${PETTACHAINER_COMMIT}
# Install PeTTa — strip the janus-swi pip dep, then point PYTHONPATH
# at the actual source dir so `import petta` resolves correctly
RUN cd /deps/PeTTa && \
sed -i "/'janus-swi'/d" setup.py && \
pip3 install .
ENV PYTHONPATH=/deps/PeTTa/python:$PYTHONPATH
# Install PeTTaChainer
RUN cd /deps/PeTTaChainer && \
pip3 install -e .
# Install pln-rag app dependencies
WORKDIR /app
COPY requirements.txt .
RUN rm -rf /usr/lib/python3/dist-packages/blinker*
RUN pip3 install --default-timeout=1000 -r requirements.txt
COPY . .
VOLUME ["/app/data"]
EXPOSE 8000
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]