Ibraaheem commited on
Commit
071a570
·
1 Parent(s): 065458e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -1,30 +1,29 @@
1
  FROM python:3.11.6-slim-bookworm as base
2
 
3
- # Install poetry globally
4
- RUN pip install poetry
 
 
 
5
 
6
- # Set up poetry
7
  ENV POETRY_VIRTUALENVS_IN_PROJECT=true
8
- ENV PATH="/root/.local/bin:$PATH"
9
 
10
  FROM base as dependencies
11
  WORKDIR /home/worker/app
12
-
13
- # Download the pyproject.toml file
14
- ADD https://huggingface.co/spaces/Ibraaheem/invenxion-chatbot/raw/main/pyproject.toml pyproject.toml
15
- ADD https://huggingface.co/spaces/Ibraaheem/invenxion-chatbot/raw/main/poetry.lock poetry.lock
16
 
17
  # Explicitly copy the project files before running poetry install
 
18
  RUN poetry config installer.max-workers 10
19
  RUN poetry install --with ui
20
-
21
  RUN pip install fastapi uvicorn
22
 
23
  FROM base as app
24
 
25
  ENV PYTHONUNBUFFERED=1
26
- ENV PORT=7860
27
- EXPOSE 7860
28
 
29
  # Prepare a non-root user
30
  RUN adduser --system worker
@@ -35,10 +34,9 @@ RUN mkdir models; chown worker models
35
 
36
  # Copy only the necessary files for the app
37
  COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
38
- COPY --chown=worker Ibraaheem/invenxion-chatbot/private_gpt/ private_gpt
39
- COPY --chown=worker Ibraaheem/invenxion-chatbot/private_gpt/docs/ docs
40
- COPY --chown=worker Ibraaheem/invenxion-chatbot/private_gpt/*.yaml Ibraaheem/invenxion-chatbot/private_gpt/*.md ./
41
 
42
  USER worker
43
-
44
- CMD ["poetry", "run", "python", "-m", "uvicorn", "private_gpt.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
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
  # Explicitly copy the project files before running poetry install
17
+ COPY pyproject.toml poetry.lock ./
18
  RUN poetry config installer.max-workers 10
19
  RUN poetry install --with ui
 
20
  RUN pip install fastapi uvicorn
21
 
22
  FROM base as app
23
 
24
  ENV PYTHONUNBUFFERED=1
25
+ ENV PORT=8080
26
+ EXPOSE 8080
27
 
28
  # Prepare a non-root user
29
  RUN adduser --system worker
 
34
 
35
  # Copy only the necessary files for the app
36
  COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
37
+ COPY --chown=worker private_gpt/ private_gpt
38
+ COPY --chown=worker docs/ docs
39
+ COPY --chown=worker *.yaml *.md ./
40
 
41
  USER worker
42
+ CMD ["uvicorn", "private_gpt.main:app", "--host", "0.0.0.0", "--port", "8080"]