Update Dockerfile
Browse files- Dockerfile +16 -10
Dockerfile
CHANGED
|
@@ -1,18 +1,24 @@
|
|
| 1 |
-
# Use official Python image
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy
|
| 8 |
-
COPY
|
| 9 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
-
#
|
| 18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use official Python slim image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy all files from current directory to /app in the container
|
| 8 |
+
COPY . /app
|
|
|
|
| 9 |
|
| 10 |
+
# Install system dependencies for PIL and PyTorch
|
| 11 |
+
RUN apt-get update && apt-get install -y \
|
| 12 |
+
gcc \
|
| 13 |
+
libgl1-mesa-glx \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# Upgrade pip and install python dependencies
|
| 17 |
+
RUN pip install --upgrade pip
|
| 18 |
+
RUN pip install -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Expose the port your FastAPI app will run on (7860 is standard on Hugging Face Spaces)
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
+
# Run the FastAPI app with uvicorn
|
| 24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|