Spaces:
Runtime error
Runtime error
Upload Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Prevent python from writing .pyc files and enable unbuffered logs
|
| 4 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 5 |
+
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
ENV PYTHONPATH=/app/src
|
| 7 |
+
|
| 8 |
+
# ✅ Redirect HuggingFace cache to a writable directory
|
| 9 |
+
ENV HF_HOME=/tmp/huggingface
|
| 10 |
+
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
|
| 11 |
+
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
|
| 12 |
+
ENV HF_MODULES_CACHE=/tmp/huggingface/modules
|
| 13 |
+
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Install dependencies
|
| 17 |
+
RUN apt-get update && apt-get install -y \
|
| 18 |
+
build-essential \
|
| 19 |
+
libglib2.0-0 \
|
| 20 |
+
libsm6 \
|
| 21 |
+
libxext6 \
|
| 22 |
+
libxrender-dev \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# Copy project files
|
| 26 |
+
COPY . .
|
| 27 |
+
|
| 28 |
+
# Install Python dependencies
|
| 29 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 30 |
+
|
| 31 |
+
# Expose port
|
| 32 |
+
EXPOSE 8000
|
| 33 |
+
|
| 34 |
+
# Run app
|
| 35 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|