File size: 847 Bytes
5db2fab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8819801
5db2fab
 
 
 
 
 
 
 
 
8819801
5db2fab
 
 
 
 
 
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
31
32
33
# Use Python 3.10 as the base image
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install uv as root
RUN pip install uv

# Copy requirements file
COPY requirements.txt .

# Install dependencies system-wide (as root)
RUN uv pip install --system -r requirements.txt

# Create a non-root user for running the application
RUN useradd -m -u 1000 user

# Create necessary directories for Chainlit and set permissions
RUN mkdir -p /app/.files /app/.cache && \
    chown -R user:user /app

# Copy the application code and set proper ownership
COPY --chown=user . .

# Switch to the non-root user for running the application
USER user

# Expose the port for Hugging Face Spaces (required)
EXPOSE 7860

# Command to run the application on Hugging Face's required port
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]