rabiyulfahim's picture
Update Dockerfile
8cdef72 verified
raw
history blame
704 Bytes
# Use lightweight Python image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies (git needed for Hugging Face)
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set environment variables for cache dirs (Docker-friendly)
ENV HF_HOME=/tmp
ENV TRANSFORMERS_CACHE=/tmp
ENV TORCHINDUCTOR_CACHE_DIR=/tmp/torch_inductor_cache
# Create cache folder
RUN mkdir -p /tmp/torch_inductor_cache
# Expose port
EXPOSE 7860
# Start FastAPI
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]