NovelTransformer / Dockerfile
NoLev's picture
Update Dockerfile
f0c24f2 verified
raw
history blame contribute delete
719 Bytes
# Use Python 3.12 slim for efficiency (CPU-only for torch)
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Set Hugging Face cache to writable dir
ENV TRANSFORMERS_CACHE=/tmp/huggingface
# Install system dependencies (for PDF handling and build tools)
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install torch --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
# Copy application code
COPY . .
# Expose port
EXPOSE 7860
# Run the app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]