iqac_fast_api / Dockerfile
kushvanth's picture
Update Dockerfile
9f27751 verified
raw
history blame contribute delete
847 Bytes
FROM python:3.12-slim
WORKDIR /app
# Set environment variables for cache directories
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
# Upgrade pip
RUN python -m pip install --upgrade pip
# Copy dependencies and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Download NLTK data to /tmp
RUN python -m nltk.downloader -d /tmp/nltk_data vader_lexicon punkt stopwords wordnet omw-1.4
# Copy application code
COPY . .
# Create cache directories with proper permissions
RUN mkdir -p /tmp/huggingface /tmp/model_cache /tmp/nltk_data && \
chmod -R 777 /tmp/huggingface /tmp/model_cache /tmp/nltk_data
# Expose port 7860
EXPOSE 7860
# Run FastAPI
CMD ["uvicorn", "fastapi_example:app", "--host", "0.0.0.0", "--port", "7860"]