Spaces:
Sleeping
Sleeping
# Use Python 3.10 as base image | |
FROM python:3.10-slim | |
# Create and set non-root user for security | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH \ | |
PYTHONUNBUFFERED=1 | |
# Set working directory | |
WORKDIR $HOME/app | |
# Copy requirements file first to leverage Docker cache | |
COPY --chown=user pyproject.toml . | |
# Install dependencies | |
RUN pip install --no-cache-dir --upgrade -e . | |
# Create and set permissions for chainlit files directory | |
RUN mkdir -p $HOME/app/.files && \ | |
mkdir -p $HOME/.chainlit | |
# Copy the rest of the application | |
COPY --chown=user . . | |
# Expose the port | |
EXPOSE 7860 | |
# Run the application | |
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"] |