Spaces:
Paused
Paused
FROM python:3.11 | |
# Create a user and set the user ID | |
RUN useradd -m -u 1000 user | |
# Set environment variables | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH \ | |
CHAINLIT_USER_FILES_DIR=/tmp/chainlit_user_files | |
# Set the working directory | |
WORKDIR $HOME/app | |
# Copy the application code and set ownership | |
COPY --chown=user . $HOME/app | |
# Ensure the necessary directories exist and have the correct permissions | |
RUN mkdir -p ${CHAINLIT_USER_FILES_DIR} $HOME/app/.files && \ | |
chown -R user:user ${CHAINLIT_USER_FILES_DIR} $HOME/app/.files && \ | |
chmod 777 ${CHAINLIT_USER_FILES_DIR} $HOME/app/.files | |
# Switch to the user | |
USER user | |
# Install dependencies | |
COPY --chown=user requirements.txt requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
RUN pip install chainlit==0.7.700 | |
# Copy the rest of the application code | |
COPY --chown=user . . | |
# Set the command to run the application | |
CMD ["chainlit", "run", "final.py", "--port", "7860"] |