Update Dockerfile
Browse files- Dockerfile +31 -29
Dockerfile
CHANGED
|
@@ -1,29 +1,31 @@
|
|
| 1 |
-
# Step 1: Use a base image with Python
|
| 2 |
-
FROM python:3.9-slim
|
| 3 |
-
|
| 4 |
-
# Step 2: Set the working directory inside the container
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Step 3: Copy the requirements file to the container
|
| 8 |
-
COPY requirements.txt .
|
| 9 |
-
|
| 10 |
-
# Step 4: Install the Python dependencies
|
| 11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
-
|
| 13 |
-
RUN pip install --no-cache-dir faiss-gpu
|
| 14 |
-
|
| 15 |
-
# Step 5: Copy the entire codebase into the container
|
| 16 |
-
COPY . .
|
| 17 |
-
|
| 18 |
-
# Step 6: Ensure FAISS index and other models are in the correct location
|
| 19 |
-
# Copy the FAISS index and other model files explicitly
|
| 20 |
-
COPY ./models /app/models
|
| 21 |
-
|
| 22 |
-
# Optional: Set permissions for the entire app directory
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# Step 1: Use a base image with Python
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Step 2: Set the working directory inside the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Step 3: Copy the requirements file to the container
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
|
| 10 |
+
# Step 4: Install the Python dependencies
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
RUN pip install --no-cache-dir faiss-gpu
|
| 14 |
+
|
| 15 |
+
# Step 5: Copy the entire codebase into the container
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Step 6: Ensure FAISS index and other models are in the correct location
|
| 19 |
+
# Copy the FAISS index and other model files explicitly
|
| 20 |
+
COPY ./models /app/models
|
| 21 |
+
|
| 22 |
+
# Optional: Set permissions for the entire app directory
|
| 23 |
+
ENV HF_HOME=/app/.cache
|
| 24 |
+
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 25 |
+
RUN chmod -R 755 /app
|
| 26 |
+
|
| 27 |
+
# Step 7: Expose the port that FastAPI will run on (default: 8000)
|
| 28 |
+
EXPOSE 8000
|
| 29 |
+
|
| 30 |
+
# Step 8: Set the entry point to run FastAPI with Uvicorn
|
| 31 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|