File size: 804 Bytes
2653ef9 e852138 2653ef9 e852138 2653ef9 e852138 2653ef9 e852138 2653ef9 e852138 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
FROM python:3.9-slim
# Set working directory
WORKDIR /code
# Copy requirements first (better caching)
COPY ./requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Set Hugging Face cache directory inside the container
ENV TRANSFORMERS_CACHE=/code/hf_cache
# Create cache directory with proper permissions
RUN mkdir -p /code/hf_cache && chmod -R 777 /code/hf_cache
# Pre-download the model at build time (so no runtime cache issues)
RUN python -c "from transformers import pipeline; pipeline('text-classification', model='knkarthick/Action_Items')"
# Copy application code
COPY ./app.py /code/app.py
# Expose port
EXPOSE 7860
# Start the FastAPI server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|