Spaces:
Runtime error
Runtime error
docker file
Browse files- Dockerfile +39 -0
- requirements.txt +11 -8
Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.9 slim image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
build-essential \
|
| 10 |
+
curl \
|
| 11 |
+
software-properties-common \
|
| 12 |
+
git \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Copy requirements first for better caching
|
| 16 |
+
COPY requirements.txt .
|
| 17 |
+
|
| 18 |
+
# Install Python dependencies
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Copy model files and application code
|
| 22 |
+
COPY final-model/ ./final-model/
|
| 23 |
+
COPY app.py .
|
| 24 |
+
COPY model_utils.py .
|
| 25 |
+
COPY index.html .
|
| 26 |
+
|
| 27 |
+
# Create a non-root user
|
| 28 |
+
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
| 29 |
+
USER appuser
|
| 30 |
+
|
| 31 |
+
# Expose port
|
| 32 |
+
EXPOSE 8000
|
| 33 |
+
|
| 34 |
+
# Health check
|
| 35 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 36 |
+
CMD curl -f http://localhost:8000/health || exit 1
|
| 37 |
+
|
| 38 |
+
# Run the application
|
| 39 |
+
CMD ["python", "app.py"]
|
requirements.txt
CHANGED
|
@@ -1,8 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
pydantic>=
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch>=1.12.0
|
| 2 |
+
transformers>=4.21.0
|
| 3 |
+
peft>=0.3.0
|
| 4 |
+
datasets>=2.0.0
|
| 5 |
+
fastapi>=0.68.0
|
| 6 |
+
uvicorn>=0.15.0
|
| 7 |
+
pydantic>=1.8.0
|
| 8 |
+
numpy>=1.21.0
|
| 9 |
+
scikit-learn>=1.0.0
|
| 10 |
+
accelerate>=0.12.0
|
| 11 |
+
tokenizers>=0.12.0
|