Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -4
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
# Install dependencies
|
@@ -6,11 +6,14 @@ RUN pip install --upgrade pip
|
|
6 |
COPY requirements.txt .
|
7 |
RUN pip install -r requirements.txt
|
8 |
|
9 |
-
#
|
10 |
RUN mkdir -p /tmp/hf-cache
|
11 |
|
|
|
|
|
|
|
12 |
# Copy app files
|
13 |
COPY main.py .
|
14 |
|
15 |
-
# Run FastAPI app
|
16 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
# Install dependencies
|
|
|
6 |
COPY requirements.txt .
|
7 |
RUN pip install -r requirements.txt
|
8 |
|
9 |
+
# Create writable Hugging Face cache
|
10 |
RUN mkdir -p /tmp/hf-cache
|
11 |
|
12 |
+
# Preload the model to avoid runtime LFS issues
|
13 |
+
RUN python -c "import os; os.environ['HF_HOME'] = '/tmp/hf-cache'; from transformers import AutoTokenizer, AutoModelForSequenceClassification; AutoTokenizer.from_pretrained('cybersectony/phishing-email-detection-distilbert_v2.4.1'); AutoModelForSequenceClassification.from_pretrained('cybersectony/phishing-email-detection-distilbert_v2.4.1')"
|
14 |
+
|
15 |
# Copy app files
|
16 |
COPY main.py .
|
17 |
|
18 |
+
# Run the FastAPI app
|
19 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|