Spaces:
Sleeping
Sleeping
FROM python:3.9 | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create a non-root user and switch to it | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
ENV PYTHONPATH="/app:$PYTHONPATH" | |
# Copy requirements first to leverage Docker cache | |
COPY --chown=user requirements.txt . | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy the application code | |
COPY --chown=user app.py . | |
COPY --chown=user apikeys.csv . | |
COPY --chown=user MODELS.csv . | |
COPY --chown=user utils.py . | |
COPY --chown=user core ./core | |
COPY --chown=user models ./models | |
# Expose the port | |
EXPOSE 7860 | |
# Start the application | |
CMD ["python", "app.py"] |