forked from zylon-ai/private-gpt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.external
42 lines (32 loc) · 1.16 KB
/
Dockerfile.external
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
FROM python:3.11.6-slim-bookworm as base
# Install poetry
RUN pip install pipx
RUN python3 -m pipx ensurepath
RUN pipx install poetry
ENV PATH="/root/.local/bin:$PATH"
ENV PATH=".venv/bin/:$PATH"
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
FROM base as dependencies
WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./
RUN poetry install --extras "ui llms-ollama embeddings-ollama vector-stores-qdrant"
FROM base as app
ENV MPLCONFIGDIR="/home/nonroot/app/models/.config/matplotlib" \
HF_HOME="/home/nonroot/app/models/cache" \
PYTHONUNBUFFERED=1 \
PORT=8080
EXPOSE 8080
# Prepare a non-root user
RUN adduser --system worker
WORKDIR /home/worker/app
RUN mkdir local_data; chown worker local_data
RUN mkdir models; chown worker models
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
COPY --chown=worker private_gpt/ private_gpt
COPY --chown=worker fern/ fern
COPY --chown=worker *.yaml *.md ./
COPY --chown=worker scripts/ scripts
ENV PYTHONPATH="$PYTHONPATH:/private_gpt/"
USER worker
ENTRYPOINT ["/bin/sh" "-c" "export PGPT_PROFILES=ollama && python -m private_gpt"]