File size: 1,023 Bytes
9f3be8d
b366622
 
9f3be8d
b366622
9f3be8d
b366622
 
9f3be8d
 
b366622
 
9f3be8d
b366622
 
9f3be8d
b366622
 
 
9f3be8d
 
b366622
 
9f3be8d
 
b366622
9f3be8d
 
 
 
b366622
 
 
 
 
9f3be8d
 
b366622
 
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
34
35
36
37
38
39
40
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"]