Spaces:
Running
Running
# Use a minimal Python image | |
FROM python:3.9-slim | |
# Set the working directory | |
RUN useradd -m -u 1000 user | |
WORKDIR /app | |
# Copy dependencies and install them | |
COPY --chown=user ./requirements.txt requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy the application files | |
COPY . . | |
# Download necessary NLTK data | |
RUN python -c "import nltk; nltk.download('vader_lexicon'); nltk.download('punkt'); nltk.download('stopwords')" | |
COPY --chown=user . /app | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Expose the required port | |
EXPOSE 7860 | |
# Run FastAPI | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |