Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- 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 |
-
#
|
| 19 |
-
|
| 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
|
| 33 |
-
COPY
|
| 34 |
-
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
|
| 38 |
|
| 39 |
-
#
|
| 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"]
|