Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +28 -18
Dockerfile
CHANGED
|
@@ -1,18 +1,28 @@
|
|
| 1 |
-
# Use official Python image
|
| 2 |
-
FROM python:3.
|
| 3 |
-
|
| 4 |
-
# Set working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official Python image with a more recent version
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
gcc \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Copy requirements from backend and install
|
| 13 |
+
COPY backend/requirements.txt .
|
| 14 |
+
|
| 15 |
+
# Upgrade pip to latest version to resolve dependency conflicts better
|
| 16 |
+
RUN pip install --upgrade pip
|
| 17 |
+
|
| 18 |
+
# Install Python dependencies
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Copy the backend code
|
| 22 |
+
COPY backend/ .
|
| 23 |
+
|
| 24 |
+
# Expose the port your FastAPI app runs on
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
|
| 27 |
+
# Command to run the FastAPI app
|
| 28 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|