sk1502 commited on
Commit
b6e2b4a
·
1 Parent(s): ceecfbc

Dockerfile update

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,22 +1,25 @@
1
- # Use your existing base
2
  FROM python:3.10
3
 
4
- # Create a non‑root user
5
  RUN useradd -m -u 1000 user
6
 
7
- # Set up working dir under root, pre-create .chainlit and translations
8
  WORKDIR /home/user/app
9
- RUN mkdir -p /home/user/app/.chainlit/translations \
10
- && chown -R user:user /home/user/app/.chainlit
11
 
12
- # Now switch to the non‑root user
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
 
17
- # Continue with copying code and installing
18
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
19
  RUN pip install --no-cache-dir -r $HOME/app/requirements.txt
 
 
20
  COPY --chown=user . $HOME/app
21
 
 
 
22
  CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10
2
 
3
+ # 1. Create a non‑root user
4
  RUN useradd -m -u 1000 user
5
 
6
+ # 2. Pre-create .files with root, then chown to the user
7
  WORKDIR /home/user/app
8
+ RUN mkdir -p /home/user/app/.files \
9
+ && chown -R user:user /home/user/app/.files
10
 
11
+ # 3. Switch to non‑root user
12
  USER user
13
  ENV HOME=/home/user \
14
  PATH=/home/user/.local/bin:$PATH
15
 
16
+ # 4. Copy and install dependencies
17
  COPY --chown=user requirements.txt $HOME/app/requirements.txt
18
  RUN pip install --no-cache-dir -r $HOME/app/requirements.txt
19
+
20
+ # 5. Copy application code
21
  COPY --chown=user . $HOME/app
22
 
23
+ # 6. Expose and run
24
+ EXPOSE 7860
25
  CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]