LalitChaudhari3 commited on
Commit
9b37324
·
verified ·
1 Parent(s): 13a5c79

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -7
Dockerfile CHANGED
@@ -1,5 +1,5 @@
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
@@ -11,16 +11,20 @@ WORKDIR /code
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"]
 
1
+ # 1. Use Python 3.9
2
+ FROM python:3.9
3
 
4
  # 2. Set up the user FIRST (Security requirement)
5
  RUN useradd -m -u 1000 user
 
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 with Ownership Fix
15
+ # This tells Docker: "Make 'user' the owner of all these files, not Root"
16
  COPY --chown=user . /code
17
 
18
+ # 6. FORCE PERMISSIONS (The Fix for Error 13)
19
+ # This grants Read/Write access to the folder so SQLite can create lock files
20
+ RUN chmod -R 777 /code
21
+
22
+ # 7. Switch to the non-root user
23
  USER user
24
 
25
+ # 8. Set Environment Variables
26
  ENV HOME=/home/user \
27
  PATH=/home/user/.local/bin:$PATH
28
 
29
+ # 9. Run the App
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]