LalitChaudhari3 commited on
Commit
fe7157e
·
verified ·
1 Parent(s): 7dbc916

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,21 +1,26 @@
1
- # 1. Use Python Image
2
- FROM python:3.9
3
 
4
- # 2. Set Working Directory
 
 
 
5
  WORKDIR /code
6
 
7
- # 3. Copy Requirements & Install
8
- COPY ./requirements.txt /code/requirements.txt
9
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
10
 
11
- # 4. COPY EVERYTHING (This copies index.html, app.py, and your src/ folder)
12
- COPY . /code
 
13
 
14
- # 5. Create User (Hugging Face Security Requirement)
15
- RUN useradd -m -u 1000 user
16
  USER user
 
 
17
  ENV HOME=/home/user \
18
  PATH=/home/user/.local/bin:$PATH
19
 
20
- # 6. Run the App using the new filename 'app.py'
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # 1. Use Python 3.10 (Better support for ChromaDB/SQLite)
2
+ FROM python:3.10
3
 
4
+ # 2. Set up the user FIRST (Security requirement)
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # 3. Set Working Directory
8
  WORKDIR /code
9
 
10
+ # 4. Copy Requirements & Install
11
+ COPY --chown=user ./requirements.txt /code/requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
13
 
14
+ # 5. COPY EVERYTHING (Crucial Change: --chown=user)
15
+ # This ensures 'user' owns the database files and can write to them
16
+ COPY --chown=user . /code
17
 
18
+ # 6. Switch to the non-root user
 
19
  USER user
20
+
21
+ # 7. Set Environment Variables
22
  ENV HOME=/home/user \
23
  PATH=/home/user/.local/bin:$PATH
24
 
25
+ # 8. Run the App
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]