rohannsinghal commited on
Commit
b6f95b7
·
1 Parent(s): f67d14c

changes in docker file

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -4,24 +4,22 @@ FROM python:3.10-slim
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
- # Copy the requirements file into the container
8
  COPY ./requirements.txt /code/requirements.txt
9
 
10
- # Install any needed packages specified in requirements.txt
11
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
- # --- START: FINAL PERMISSION FIXES ---
14
- # Create writable directories for caches, databases, and temporary files.
15
- RUN mkdir -p /code/cache && chmod 777 /code/cache
16
- RUN mkdir -p /code/app/chroma_db && chmod -R 777 /code/app/chroma_db
17
- RUN mkdir -p /tmp/docs && chmod 777 /tmp/docs # <-- ADD THIS LINE
18
- # Tell all Hugging Face libraries to use the new cache directory
19
- ENV HF_HOME=/code/cache
20
- ENV SENTENCE_TRANSFORMERS_HOME=/code/cache
21
- # --- END: FINAL PERMISSION FIXES ---
22
 
23
- # Copy your application code into the container
24
- COPY ./app /code/app
25
 
26
- # Command to run the application when the container launches
27
- CMD ["uvicorn", "app.main_api:app", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
+ # Copy only the requirements file first to leverage Docker's build cache
8
  COPY ./requirements.txt /code/requirements.txt
9
 
10
+ # Install all Python dependencies, without using a cache to ensure a fresh install
11
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt [cite: 1]
12
 
13
+ # Create writable directories for caches, databases, and temporary files
14
+ # and set the appropriate environment variables.
15
+ RUN mkdir -p /code/cache && chmod 777 /code/cache [cite: 2]
16
+ RUN mkdir -p /code/app/chroma_db && chmod -R 777 /code/app/chroma_db [cite: 2]
17
+ RUN mkdir -p /tmp/docs && chmod 777 /tmp/docs [cite: 2]
18
+ ENV HF_HOME=/code/cache
19
+ ENV SENTENCE_TRANSFORMERS_HOME=/code/cache
 
 
20
 
21
+ # Now, copy the rest of your application code
22
+ COPY ./app /code/app
23
 
24
+ # Define the command to run your application
25
+ CMD ["uvicorn", "app.main_api:app", "--host", "0.0.0.0", "--port", "7860"] [cite: 1]