Spaces:
Sleeping
Sleeping
# Use a base image optimized for Python with Uvicorn and Gunicorn installed | |
FROM tiangolo/uvicorn-gunicorn:python3.10-slim | |
# Add a non-root user and install necessary packages | |
RUN adduser --disabled-password --gecos '' retriever-user \ | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
curl wget python3.10 python3-distutils python3-pip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Switch to non-root user for security | |
USER retriever-user | |
# Set the working directory and copy application files | |
COPY --chown=retriever-user:retriever-user . /home/retriever-user/retriever | |
WORKDIR /home/retriever-user/retriever | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose the port Flask will run on | |
EXPOSE 8000 | |
# Run Flask command to serve the application | |
CMD ["gunicorn", "-w 4", "-b :8000", "app:app"] | |