Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
@@ -1,9 +1,6 @@
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Set working directory
|
5 |
-
WORKDIR /app
|
6 |
-
|
7 |
# Install system dependencies (poppler-utils and tesseract-ocr)
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
poppler-utils \
|
@@ -11,6 +8,12 @@ RUN apt-get update && apt-get install -y \
|
|
11 |
libtesseract-dev \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Copy requirements.txt and install Python dependencies
|
15 |
COPY requirements.txt .
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
@@ -18,6 +21,12 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
18 |
# Copy the app code
|
19 |
COPY app.py .
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
# Expose the port Gradio will run on
|
22 |
EXPOSE 7860
|
23 |
|
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.10-slim
|
3 |
|
|
|
|
|
|
|
4 |
# Install system dependencies (poppler-utils and tesseract-ocr)
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
poppler-utils \
|
|
|
8 |
libtesseract-dev \
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
+
# Create a non-root user
|
12 |
+
RUN useradd -m appuser
|
13 |
+
|
14 |
+
# Set working directory
|
15 |
+
WORKDIR /app
|
16 |
+
|
17 |
# Copy requirements.txt and install Python dependencies
|
18 |
COPY requirements.txt .
|
19 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
21 |
# Copy the app code
|
22 |
COPY app.py .
|
23 |
|
24 |
+
# Create a writable directory for Gradio flagging
|
25 |
+
RUN mkdir -p /tmp/flagged && chown -R appuser:appuser /tmp/flagged
|
26 |
+
|
27 |
+
# Switch to non-root user
|
28 |
+
USER appuser
|
29 |
+
|
30 |
# Expose the port Gradio will run on
|
31 |
EXPOSE 7860
|
32 |
|