File size: 2,682 Bytes
a2383a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be4211a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a2383a1
 
be4211a
a2383a1
be4211a
a2383a1
be4211a
 
 
 
a2383a1
be4211a
 
 
a2383a1
be4211a
c084ff7
5c44ea2
be4211a
 
289c44a
be4211a
 
e9d579b
be4211a
 
 
e9d579b
be4211a
a2383a1
 
be4211a
716d5ad
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# FROM python:3.10
# RUN useradd -m -u 1000 user
# USER root
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:$PATH
# WORKDIR $HOME/app
# COPY --chown=user:user . $HOME/app
# # COPY --chown=user . $HOME/app
# COPY requirements.txt .
# # COPY ./requirements.txt ~/app/requirements.txt

# RUN pip install --upgrade pip
# RUN pip install --no-cache-dir -r requirements.txt
# # RUN pip install -r requirements.
# # Expose port
# EXPOSE 7860
# # RUN pip install pydantic==2.10.1 chainlit
# # COPY . .

# # Ensure app and .local have proper permissions
# # USER root
# RUN chmod -R 755 /home/user/app
# RUN chmod -R 755 /home/user/.local
# RUN mkdir -p /home/user/app/.files && chown -R user:user /home/user/app/.files


# USER user

# CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]

# # CMD ["chainlit", "run", "app.py", "--port", "7860"]


# FROM python:3.10
# # Create user with specific UID
# RUN useradd -m -u 1000 user
# # Set environment variables
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:$PATH
# # Set working directory
# WORKDIR $HOME/app
# # Copy requirements and install dependencies as root
# COPY requirements.txt .
# RUN pip install --upgrade pip && \
#     pip install --no-cache-dir -r requirements.txt
# # Copy application files
# COPY . .
# # Create necessary directories and set permissions
# RUN mkdir -p /home/user/app/.files && \
#     mkdir -p /home/user/.local && \
#     chown -R user:user /home/user
# RUN chown -R user:user /home/user && \
#     chmod -R 755 /home/user/app
# # RUN pip install pydantic==2.10.1 chainlit
# COPY chainlit.md .
# COPY .chainlit/config.yaml /home/user/app/.chainlit/config.yaml
# # Expose port
# EXPOSE 7860
# # Switch to non-root user
# USER user
# # Run the application
# # CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860", "--no-cache"]
# CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860", "--headless"]


# CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]

FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

# Add user - this is the user that will run the app
# If you do not set user, the app will run as root (undesirable)
RUN useradd -m -u 1000 user
USER user

# Set the home directory and path
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH        

ENV UVICORN_WS_PROTOCOL=websockets


# Set the working directory
WORKDIR $HOME/app

# Copy the app to the container
COPY --chown=user . $HOME/app

# Install the dependencies
# RUN uv sync --frozen
RUN uv sync

# Expose the port
EXPOSE 7860

# Run the app
CMD ["uv", "run", "chainlit", "run", "app_2.py", "--host", "0.0.0.0", "--port", "7860"]