Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +18 -5
Dockerfile
CHANGED
|
@@ -1,15 +1,28 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
|
|
|
|
| 8 |
COPY requirements.txt .
|
| 9 |
-
RUN pip install --no-cache-dir -
|
|
|
|
| 10 |
|
|
|
|
| 11 |
COPY . .
|
| 12 |
|
|
|
|
| 13 |
EXPOSE 8000
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
| 1 |
+
# ==============================================================================
|
| 2 |
+
# Dockerfile for the Python/FastAPI Backend (Corrected)
|
| 3 |
+
# ==============================================================================
|
| 4 |
+
# Use an official Python runtime as a parent image
|
| 5 |
+
FROM python:3.10-slim
|
| 6 |
|
| 7 |
+
# Set the working directory in the container
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# --- Environment Variables ---
|
| 11 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
| 12 |
+
ENV PYTHONUNBUFFERED 1
|
| 13 |
|
| 14 |
+
# --- Install Dependencies ---
|
| 15 |
COPY requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 17 |
+
pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# --- Copy Application Code and Model ---
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
+
# --- Expose Port and Run Application ---
|
| 23 |
EXPOSE 8000
|
| 24 |
+
|
| 25 |
+
# Command to run the application using python's module flag (-m)
|
| 26 |
+
# This is a more robust way to run uvicorn inside a container.
|
| 27 |
+
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 28 |
|