Spaces:
Runtime error
Runtime error
Commit
·
95d0556
1
Parent(s):
11406d1
firstCommit6
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -2,29 +2,29 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libgl1-mesa-glx \
|
| 7 |
libglib2.0-0 \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
# Install dependencies
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --upgrade pip
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
-
# Copy
|
| 16 |
COPY main.py .
|
| 17 |
|
| 18 |
-
#
|
| 19 |
RUN mkdir -p /app/hf_cache
|
| 20 |
-
|
| 21 |
-
# ✅ Set correct environment variable
|
| 22 |
ENV HF_HOME=/app/hf_cache
|
| 23 |
|
| 24 |
-
#
|
| 25 |
ENV HF_TOKEN=$HF_TOKEN
|
| 26 |
|
|
|
|
| 27 |
EXPOSE 8000
|
| 28 |
|
| 29 |
-
# Run
|
| 30 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install required system packages
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
libgl1-mesa-glx \
|
| 8 |
libglib2.0-0 \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Install Python dependencies
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --upgrade pip
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
+
# Copy application code
|
| 17 |
COPY main.py .
|
| 18 |
|
| 19 |
+
# Create writable cache directory for Hugging Face
|
| 20 |
RUN mkdir -p /app/hf_cache
|
|
|
|
|
|
|
| 21 |
ENV HF_HOME=/app/hf_cache
|
| 22 |
|
| 23 |
+
# Optional: Pass your Hugging Face token
|
| 24 |
ENV HF_TOKEN=$HF_TOKEN
|
| 25 |
|
| 26 |
+
# Expose port for Uvicorn
|
| 27 |
EXPOSE 8000
|
| 28 |
|
| 29 |
+
# Run the FastAPI app (from main.py)
|
| 30 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|