Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -20
Dockerfile
CHANGED
|
@@ -1,39 +1,36 @@
|
|
| 1 |
# Lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# System deps
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
ffmpeg git build-essential \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
ENV WHISPER_MODEL=base
|
| 18 |
|
| 19 |
-
# Copy files
|
| 20 |
WORKDIR /app
|
| 21 |
COPY requirements.txt .
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
COPY app.py .
|
| 25 |
-
COPY README.md .
|
| 26 |
|
| 27 |
-
#
|
| 28 |
ENV PORT=7860
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
#Comment out if build time becomes too long
|
| 32 |
-
RUN python -c "import nltk; \
|
| 33 |
-
from nltk.sentiment.vader import SentimentIntensityAnalyzer as _; \
|
| 34 |
-
import nltk; \
|
| 35 |
-
nltk.download('vader_lexicon'); \
|
| 36 |
-
whisper.load_model('${WHISPER_MODEL}')"
|
| 37 |
-
|
| 38 |
-
# Start FastAPI with uvicorn
|
| 39 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# System deps
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
ffmpeg git build-essential \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# Make writable dirs for caches and NLTK
|
| 10 |
+
RUN mkdir -p /data/nltk_data \
|
| 11 |
+
/data/huggingface/transformers \
|
| 12 |
+
/data/huggingface/datasets \
|
| 13 |
+
/data/tmp && chmod -R 777 /data
|
| 14 |
|
| 15 |
+
# Point all caches to /data (writable)
|
| 16 |
+
ENV NLTK_DATA=/data/nltk_data
|
| 17 |
+
ENV HF_HOME=/data/huggingface
|
| 18 |
+
ENV TRANSFORMERS_CACHE=/data/huggingface/transformers
|
| 19 |
+
ENV HF_DATASETS_CACHE=/data/huggingface/datasets
|
| 20 |
+
ENV TMPDIR=/data/tmp
|
| 21 |
+
|
| 22 |
+
# Optional: choose Whisper size via env (ignored now if using SpeechRecognition)
|
| 23 |
ENV WHISPER_MODEL=base
|
| 24 |
|
|
|
|
| 25 |
WORKDIR /app
|
| 26 |
COPY requirements.txt .
|
| 27 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
| 29 |
COPY app.py .
|
| 30 |
+
COPY README.md .
|
| 31 |
|
| 32 |
+
# Spaces expects port 7860
|
| 33 |
ENV PORT=7860
|
| 34 |
|
| 35 |
+
# Start FastAPI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|