Spaces:
Sleeping
Sleeping
FROM python:3.12 | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory | |
WORKDIR $HOME/app | |
# Copy files and install dependencies | |
COPY --chown=user . $HOME/app | |
COPY ./requirements.txt ./requirements.txt | |
# Install dependencies | |
RUN pip install --upgrade pip | |
RUN pip install -r requirements.txt | |
# List installed packages for debugging | |
RUN pip list | |
# Ensure the data directory exists with correct permissions | |
USER root | |
RUN mkdir -p /home/user/app/data/vectorstore && \ | |
chown -R user:user /home/user/app/data && \ | |
chmod -R 777 /home/user/app/data | |
# Ensure translation directory and default files exist | |
RUN mkdir -p /home/user/app/.chainlit/translations && \ | |
echo '{}' > /home/user/app/.chainlit/translations/en-US.json | |
USER user | |
# Run the Chainlit application with Gunicorn and Uvicorn | |
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "app:app", "--bind", "0.0.0.0:7860"] | |