s4um1l commited on
Commit
7517b55
·
1 Parent(s): 1b529d9

fixed permission issues tested locally

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -8
Dockerfile CHANGED
@@ -1,26 +1,33 @@
1
  # Use Python 3.10 as the base image
2
  FROM python:3.10-slim
3
- RUN useradd -m -u 1000 user
4
 
5
- # Switch to the "user" user
6
- USER user
7
  # Set working directory
8
  WORKDIR /app
9
 
10
- # Install uv
11
  RUN pip install uv
12
 
13
  # Copy requirements file
14
- COPY --chown=user requirements.txt .
15
 
16
- # Install dependencies system-wide
17
  RUN uv pip install --system -r requirements.txt
18
 
19
- # Copy the application code
 
 
 
 
 
 
 
20
  COPY --chown=user . .
21
 
 
 
 
22
  # Expose the port for Hugging Face Spaces (required)
23
  EXPOSE 7860
24
 
25
  # Command to run the application on Hugging Face's required port
26
- CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
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"]