Spaces:
Sleeping
Sleeping
Upload Dockerfile
Browse files- Dockerfile +9 -7
Dockerfile
CHANGED
|
@@ -1,17 +1,20 @@
|
|
| 1 |
-
# Use a
|
| 2 |
-
|
| 3 |
-
FROM nvcr.io/nvidia/pytorch:24.01-py3
|
| 4 |
|
| 5 |
# Set environment variables
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
# Hugging Face Spaces uses port 7860 by default
|
| 8 |
ENV PORT=7860
|
| 9 |
|
| 10 |
# Set working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Copy requirements and install Python dependencies
|
| 14 |
-
# We use --no-cache-dir to keep the image size small
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
|
@@ -21,6 +24,5 @@ COPY . .
|
|
| 21 |
# Expose the port
|
| 22 |
EXPOSE 7860
|
| 23 |
|
| 24 |
-
# Command to run the application
|
| 25 |
-
# We use the explicit port 7860 as required by HF Spaces
|
| 26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use a slim Python base image for fast builds and small footprint
|
| 2 |
+
FROM python:3.11-slim
|
|
|
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
# Hugging Face Spaces uses port 7860 by default
|
| 7 |
ENV PORT=7860
|
| 8 |
|
| 9 |
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Install system dependencies if needed (minimal for this app)
|
| 13 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
build-essential \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
# Copy requirements and install Python dependencies
|
|
|
|
| 18 |
COPY requirements.txt .
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
|
|
|
| 24 |
# Expose the port
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
+
# Command to run the application
|
|
|
|
| 28 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|