chainlit / Dockerfile
asharib's picture
Update Dockerfile
088f9f0 verified
raw
history blame contribute delete
748 Bytes
FROM python:3.10-slim
# Create a non-root user for better security and permissions
RUN useradd -m -u 1000 user
# Set the working directory
WORKDIR /app
# Copy requirements and install dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Add the user's local bin directory to PATH
ENV PATH="/home/user/.local/bin:${PATH}"
# Copy all application files
COPY . /app
# Create the .files directory with proper permissions
RUN mkdir -p /app/.files && chmod -R 777 /app/.files
# Change the user to the non-root user
USER user
# Expose the required port (7860 for Hugging Face Spaces)
EXPOSE 7860
# Run Chainlit application
CMD ["chainlit", "run", "main.py", "--port", "7860", "--headless"]