radhabaran commited on
Commit
3e38725
·
verified ·
1 Parent(s): ac37fc2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -15,9 +15,8 @@ RUN apt-get update && apt-get install -y \
15
  libopencv-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # Copy requirements first
19
- COPY requirements.txt .
20
- RUN pip install --no-cache-dir -r requirements.txt
21
 
22
  # Create necessary directories from Config
23
  RUN mkdir -p /code/data/documents/pdfs \
@@ -27,17 +26,17 @@ RUN mkdir -p /code/data/documents/pdfs \
27
  /code/data/cache \
28
  /code/data/temp \
29
  /code/data/stored_images \
30
- /code/data/local_qdrant
 
31
 
32
- # Copy config and application files
33
- COPY config.py .
34
- COPY . .
35
 
36
- # Set permissions for data directories
37
- RUN chmod -R 777 /code/data
38
 
39
- # Create a non-root user
40
- RUN useradd -m appuser
41
  USER appuser
42
 
43
  CMD ["python", "app.py"]
 
15
  libopencv-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Create non-root user first
19
+ RUN useradd -m appuser
 
20
 
21
  # Create necessary directories from Config
22
  RUN mkdir -p /code/data/documents/pdfs \
 
26
  /code/data/cache \
27
  /code/data/temp \
28
  /code/data/stored_images \
29
+ /code/data/local_qdrant \
30
+ && chown -R appuser:appuser /code
31
 
32
+ # Copy requirements and install
33
+ COPY --chown=appuser:appuser requirements.txt .
34
+ RUN pip install --no-cache-dir -r requirements.txt
35
 
36
+ # Copy application files with correct ownership
37
+ COPY --chown=appuser:appuser . .
38
 
39
+ # Switch to non-root user
 
40
  USER appuser
41
 
42
  CMD ["python", "app.py"]