Update Dockerfile
Browse files- Dockerfile +16 -1
Dockerfile
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
|
| 8 |
-
|
|
|
|
| 9 |
|
|
|
|
| 10 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use official Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Set cache directories to avoid permission issues
|
| 8 |
+
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
| 9 |
+
ENV HF_HOME=/tmp/hf_home
|
| 10 |
+
ENV HF_DATASETS_CACHE=/tmp/hf_datasets_cache
|
| 11 |
+
ENV HF_METRICS_CACHE=/tmp/hf_metrics_cache
|
| 12 |
+
|
| 13 |
+
# Copy requirements and app code
|
| 14 |
COPY requirements.txt .
|
| 15 |
+
COPY app.py .
|
| 16 |
+
|
| 17 |
+
# Install dependencies
|
| 18 |
+
RUN pip install --upgrade pip
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
+
# Expose the default port
|
| 22 |
+
EXPOSE 7860
|
| 23 |
|
| 24 |
+
# Command to run the app
|
| 25 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|