gcharanteja commited on
Commit
6b75c6d
·
1 Parent(s): 79f9c57
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -1,13 +1,12 @@
1
  FROM python:3.10-slim
2
 
3
- # 1. Create user 'user' with UID 1000 (HF Requirement)
4
  RUN useradd -m -u 1000 user
5
 
6
  # 2. Set environment variables
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
  ENV CHROMA_SERVER_HOST=0.0.0.0
9
  ENV CHROMA_SERVER_HTTP_PORT=7860
10
- ENV PERSIST_DIRECTORY=/data/chroma_db
11
 
12
  # 3. Set working directory
13
  WORKDIR /app
@@ -19,17 +18,17 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
  # 5. Copy application code
20
  COPY --chown=user . /app
21
 
22
- # 6. Fix Permissions:
23
- # Ensure /app is writable by user (for logs)
24
- # Ensure /data is writable by user (for DB)
25
- RUN chown -R user:user /app /data && chmod -R 755 /app /data
26
 
27
  # 7. Switch to non-root user
28
  USER user
29
 
30
- # 8. Expose port 7860
31
  EXPOSE 7860
32
 
33
  # 9. Start ChromaDB
34
- # We explicitly set the log config to default (console) to avoid file permission issues
35
- CMD ["chroma", "run", "--path", "/data/chroma_db", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. Create user 'user' with UID 1000
4
  RUN useradd -m -u 1000 user
5
 
6
  # 2. Set environment variables
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
  ENV CHROMA_SERVER_HOST=0.0.0.0
9
  ENV CHROMA_SERVER_HTTP_PORT=7860
 
10
 
11
  # 3. Set working directory
12
  WORKDIR /app
 
18
  # 5. Copy application code
19
  COPY --chown=user . /app
20
 
21
+ # 6. Ensure /app is writable by user (for logs)
22
+ RUN chown -R user:user /app
 
 
23
 
24
  # 7. Switch to non-root user
25
  USER user
26
 
27
+ # 8. Expose port
28
  EXPOSE 7860
29
 
30
  # 9. Start ChromaDB
31
+ # We use a shell command to:
32
+ # 1. Create /data/chroma_db if it doesn't exist (at runtime)
33
+ # 2. Start chroma pointing to it
34
+ CMD ["sh", "-c", "mkdir -p /data/chroma_db && chroma run --path /data/chroma_db --host 0.0.0.0 --port 7860"]