File size: 748 Bytes
c5c7e10 088f9f0 c5c7e10 088f9f0 c5c7e10 088f9f0 c5c7e10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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"]
|