voice4text_summarizer / Dockerfile
Ravishankarsharma's picture
Update Dockerfile
28e865a verified
# 1️⃣ Base image
FROM python:3.11-slim
# 2️⃣ Environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV UPLOAD_DIR=/tmp/uploads
ENV OUTPUT_DIR=/tmp/outputs
ENV POLL_SECONDS=8.0
ENV WHISPER_MODEL=small
ENV SUMM_MODEL=sshleifer/distilbart-cnn-12-6
ENV MAX_SUMMARY_TOKENS=180
ENV TRANSFORMERS_CACHE=/tmp/cache
ENV HF_HOME=/tmp/cache
ENV XDG_CACHE_HOME=/tmp/cache
ENV NLTK_DATA=/tmp/nltk_data
# 3️⃣ Set working directory
WORKDIR /app
# 4️⃣ Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
git \
build-essential \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# 5️⃣ Upgrade pip and wheel
RUN pip install --upgrade pip setuptools wheel
# 6️⃣ Copy requirements and install Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 7️⃣ Copy app code
COPY app.py .
# 8️⃣ Create directories
RUN mkdir -p $UPLOAD_DIR $OUTPUT_DIR $NLTK_DATA $TRANSFORMERS_CACHE
# 9️⃣ Download NLTK punkt tokenizer
RUN python -m nltk.downloader -d $NLTK_DATA punkt
# 10️⃣ Expose port
EXPOSE 7860
# 11️⃣ Start FastAPI
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]