Update Dockerfile
Browse files- Dockerfile +5 -2
Dockerfile
CHANGED
|
@@ -3,16 +3,19 @@ FROM python:3.9
|
|
| 3 |
|
| 4 |
# Create a non-root user and switch to it
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
-
USER user
|
| 7 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
|
| 9 |
# Set the working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
# Install system dependencies (Tesseract OCR)
|
|
|
|
| 13 |
RUN apt-get update -y && \
|
| 14 |
apt-get install -y tesseract-ocr
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
# Copy and install Python dependencies
|
| 17 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
| 3 |
|
| 4 |
# Create a non-root user and switch to it
|
| 5 |
RUN useradd -m -u 1000 user
|
|
|
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
|
| 8 |
# Set the working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
+
# Install system dependencies (Tesseract OCR) as root
|
| 12 |
+
USER root
|
| 13 |
RUN apt-get update -y && \
|
| 14 |
apt-get install -y tesseract-ocr
|
| 15 |
|
| 16 |
+
# Switch back to the non-root user
|
| 17 |
+
USER user
|
| 18 |
+
|
| 19 |
# Copy and install Python dependencies
|
| 20 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 21 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|