File size: 1,042 Bytes
f85c983
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# FROM python:3.10
# RUN useradd -m -u 1000 user
# USER user
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:$PATH
# WORKDIR $HOME/app
# COPY --chown=user . $HOME/app
# COPY ./requirements.txt ~/app/requirements.txt
# RUN pip install --upgrade pip
# RUN pip install -r requirements.txt
# COPY . .
# CMD ["chainlitdocker buildx build .", "run", "app.py", "--port", "7860"]
FROM python:3.10-slim

# Create a non-root user
RUN useradd -m -u 1000 user
USER user

# Set environment variables
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

# Set working directory
WORKDIR $HOME/app

# Copy requirements file
COPY --chown=user . $HOME/app
COPY ./requirements.txt $HOME/app/requirements.txt

# Upgrade pip and install dependencies
RUN pip install --timeout=100 --index-url https://pypi.org/simple --upgrade pip
RUN pip install --timeout=100 --index-url https://pypi.org/simple -r requirements.txt

# Copy the rest of the application files
COPY . .

# Set the entrypoint command
CMD ["chainlit", "run", "app.py", "--port", "7860"]