Spaces:
Sleeping
Sleeping
Commit ·
b6f95b7
1
Parent(s): f67d14c
changes in docker file
Browse files- 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
|
| 8 |
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
#
|
| 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
|
| 18 |
-
|
| 19 |
-
ENV
|
| 20 |
-
ENV SENTENCE_TRANSFORMERS_HOME=/code/cache
|
| 21 |
-
# --- END: FINAL PERMISSION FIXES ---
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
COPY ./app /code/app
|
| 25 |
|
| 26 |
-
#
|
| 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]
|