Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +0 -13
Dockerfile
CHANGED
@@ -1,38 +1,25 @@
|
|
1 |
-
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Set environment variables to prevent interactive prompts during installation
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
|
7 |
-
# Install system dependencies required by the application (only poppler)
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
poppler-utils \
|
10 |
&& apt-get clean \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
# Create a non-root user for security
|
14 |
RUN useradd --create-home --shell /bin/bash appuser
|
15 |
|
16 |
-
# Set the working directory in the container
|
17 |
WORKDIR /app
|
18 |
|
19 |
-
# Copy the requirements file and install Python dependencies
|
20 |
-
# This is done in a separate layer to leverage Docker's build cache
|
21 |
COPY requirements.txt .
|
22 |
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
|
24 |
-
# Copy the rest of the application's code into the container
|
25 |
COPY app.py .
|
26 |
|
27 |
-
# Change ownership of the app directory to the non-root user
|
28 |
RUN chown -R appuser:appuser /app
|
29 |
|
30 |
-
# Switch to the non-root user
|
31 |
USER appuser
|
32 |
|
33 |
-
# Expose the port the Gradio app will run on
|
34 |
EXPOSE 7860
|
35 |
|
36 |
-
# The command to run the Gradio application
|
37 |
-
# Gradio's launch() method will automatically bind to 0.0.0.0 inside Docker.
|
38 |
CMD ["python", "app.py"]
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
|
|
3 |
ENV DEBIAN_FRONTEND=noninteractive
|
4 |
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
poppler-utils \
|
7 |
&& apt-get clean \
|
8 |
&& rm -rf /var/lib/apt/lists/*
|
9 |
|
|
|
10 |
RUN useradd --create-home --shell /bin/bash appuser
|
11 |
|
|
|
12 |
WORKDIR /app
|
13 |
|
|
|
|
|
14 |
COPY requirements.txt .
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
|
|
17 |
COPY app.py .
|
18 |
|
|
|
19 |
RUN chown -R appuser:appuser /app
|
20 |
|
|
|
21 |
USER appuser
|
22 |
|
|
|
23 |
EXPOSE 7860
|
24 |
|
|
|
|
|
25 |
CMD ["python", "app.py"]
|