Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +22 -10
Dockerfile
CHANGED
|
@@ -1,17 +1,29 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM python:3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
COPY .
|
| 9 |
-
|
| 10 |
-
# Install dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
# Run the
|
| 17 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use lightweight Python image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies for transformers
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends gcc python3-dev && \
|
| 7 |
+
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Install Python dependencies
|
| 13 |
+
COPY requirements.txt .
|
|
|
|
|
|
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
+
# Cache the AI model (Falcon-7B)
|
| 17 |
+
RUN python -c """
|
| 18 |
+
from transformers import pipeline
|
| 19 |
+
pipeline('text-generation', model='tiiuae/falcon-7b-instruct')
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
# Copy application files
|
| 23 |
+
COPY app.py text2generation.py ./
|
| 24 |
+
|
| 25 |
+
# Expose Hugging Face's default port
|
| 26 |
+
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Run the application with Gunicorn for production
|
| 29 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "app:app"]
|