Ibraaheem commited on
Commit
f78a720
·
1 Parent(s): e329fac

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -18,6 +18,7 @@ COPY pyproject.toml poetry.lock ./
18
  RUN poetry config installer.max-workers 10
19
  RUN poetry install --with ui
20
  RUN poetry install --extras chroma
 
21
 
22
  FROM base as app
23
 
@@ -30,18 +31,17 @@ RUN adduser --system worker
30
  WORKDIR /home/worker/app
31
 
32
  # Ensure the worker user has the necessary permissions
33
- RUN mkdir -p local_data/private_gpt/chroma_db && chown -R worker local_data/private_gpt
 
 
 
 
 
 
34
 
35
- # Ensure the 'meta.json' file has the correct permissions
36
- RUN touch local_data/private_gpt/chroma_db/meta.json && chown worker local_data/private_gpt/chroma_db/meta.json
37
 
38
- # Allow the user to write to the chroma_db directory
39
- RUN chmod 777 local_data/private_gpt/chroma_db
40
- USER worker
41
 
42
- # Create and activate virtual environment
43
- RUN python -m venv .venv
44
- ENV PATH="/home/worker/app/.venv/bin:$PATH"
45
 
46
- # Print the contents of .venv/bin and run uvicorn
47
- CMD ["sh", "-c", "ls -l .venv/bin && .venv/bin/uvicorn private_gpt.main:app --host 0.0.0.0 --port 7860"]
 
18
  RUN poetry config installer.max-workers 10
19
  RUN poetry install --with ui
20
  RUN poetry install --extras chroma
21
+ RUN pip install fastapi uvicorn
22
 
23
  FROM base as app
24
 
 
31
  WORKDIR /home/worker/app
32
 
33
  # Ensure the worker user has the necessary permissions
34
+ RUN mkdir -p local_data/private_gpt/chromadb && chown -R worker local_data/private_gpt
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 private_gpt/ private_gpt
39
+ COPY --chown=worker docs/ docs
40
+ COPY --chown=worker *.yaml *.md ./
41
 
 
 
42
 
 
 
 
43
 
44
+ USER worker
 
 
45
 
46
+ # Activate the virtual environment and run uvicorn
47
+ CMD [".venv/bin/uvicorn", "private_gpt.main:app", "--host", "0.0.0.0", "--port", "7860"]