Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Install system dependencies
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
build-essential \
|
| 8 |
+
git \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Copy requirements and install Python dependencies
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Set environment variables for Hugging Face
|
| 17 |
+
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
| 18 |
+
ENV HF_HOME=/tmp/hf_cache
|
| 19 |
+
ENV TOKENIZERS_PARALLELISM=false
|
| 20 |
+
|
| 21 |
+
# Create cache directories
|
| 22 |
+
RUN mkdir -p /tmp/transformers_cache /tmp/hf_cache
|
| 23 |
+
|
| 24 |
+
# Copy application code
|
| 25 |
+
COPY app.py .
|
| 26 |
+
|
| 27 |
+
# Expose port 7860 for Hugging Face Spaces
|
| 28 |
+
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
# Run the Flask app
|
| 31 |
+
CMD ["python", "app.py"]
|