Skip to content

Commit 0d677e1

Browse files
authored
feat: move torch and transformers to local group (#1172)
1 parent ad512e3 commit 0d677e1

File tree

5 files changed

+566
-560
lines changed

5 files changed

+566
-560
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
uses: docker/build-push-action@v5
4040
with:
4141
context: .
42+
file: Dockerfile.external
4243
push: true
4344
tags: ${{ steps.meta.outputs.tags }}
4445
labels: ${{ steps.meta.outputs.labels }}

Dockerfile.external

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM python:3.11.6-slim-bookworm as base
2+
3+
# Install poetry
4+
RUN pip install pipx
5+
RUN python3 -m pipx ensurepath
6+
RUN pipx install poetry
7+
ENV PATH="/root/.local/bin:$PATH"
8+
9+
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
10+
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
11+
12+
FROM base as dependencies
13+
WORKDIR /home/worker/app
14+
COPY pyproject.toml poetry.lock ./
15+
16+
RUN poetry install --with ui
17+
18+
FROM base as app
19+
20+
ENV PYTHONUNBUFFERED=1
21+
ENV PORT=8080
22+
EXPOSE 8080
23+
24+
# Prepare a non-root user
25+
RUN adduser --system worker
26+
WORKDIR /home/worker/app
27+
28+
RUN mkdir local_data; chown worker local_data
29+
RUN mkdir models; chown worker models
30+
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
31+
COPY --chown=worker private_gpt/ private_gpt
32+
COPY --chown=worker docs/ docs
33+
COPY --chown=worker *.yaml *.md ./
34+
35+
USER worker
36+
ENTRYPOINT .venv/bin/python -m private_gpt

Dockerfile renamed to Dockerfile.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN python3 -m pipx ensurepath
88
RUN pipx install poetry
99
ENV PATH="/root/.local/bin:$PATH"
1010

11-
# Dependencies to build llama-cpp and wget
11+
# Dependencies to build llama-cpp
1212
RUN apt update && apt install -y \
1313
libopenblas-dev\
1414
ninja-build\
@@ -23,13 +23,13 @@ FROM base as dependencies
2323
WORKDIR /home/worker/app
2424
COPY pyproject.toml poetry.lock ./
2525

26+
RUN poetry install --with local
2627
RUN poetry install --with ui
2728

2829
FROM base as app
2930

3031
ENV PYTHONUNBUFFERED=1
3132
ENV PORT=8080
32-
ENV PGPT_PROFILES=docker
3333
EXPOSE 8080
3434

3535
# Prepare a non-root user

0 commit comments

Comments
 (0)