rezkyyayang commited on
Commit
5db2fab
·
verified ·
1 Parent(s): a4f5425

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -9
Dockerfile CHANGED
@@ -1,11 +1,33 @@
1
- FROM python:3.11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  RUN useradd -m -u 1000 user
 
 
 
 
 
 
 
 
 
3
  USER user
4
- ENV HOME=/home/user \
5
- PATH=/home/user/.local/bin:$PATH
6
- WORKDIR $HOME/app
7
- COPY --chown=user . $HOME/app
8
- COPY ./requirements.txt ~/app/requirements.txt
9
- RUN pip install -r requirements.txt --use-deprecated=legacy-resolver
10
- COPY . .
11
- CMD ["chainlit", "run", "app.py", "-w"]
 
1
+ # Use Python 3.10 as the base image
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install uv as root
8
+ RUN pip install uv
9
+
10
+ # Copy requirements file
11
+ COPY requirements.txt .
12
+
13
+ # Install dependencies system-wide (as root)
14
+ RUN uv pip install --system -r requirements.txt
15
+
16
+ # Create a non-root user for running the application
17
  RUN useradd -m -u 1000 user
18
+
19
+ # Create necessary directories for Chainlit and set permissions
20
+ RUN mkdir -p /app/.files /app/.cache && \
21
+ chown -R user:user /app
22
+
23
+ # Copy the application code and set proper ownership
24
+ COPY --chown=user . .
25
+
26
+ # Switch to the non-root user for running the application
27
  USER user
28
+
29
+ # Expose the port for Hugging Face Spaces (required)
30
+ EXPOSE 7860
31
+
32
+ # Command to run the application on Hugging Face's required port
33
+ CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]