Update Dockerfile
Browse files- Dockerfile +9 -9
Dockerfile
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
# Dockerfile
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# avoid interactive prompts during apt installs
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV CHROME_BIN=/usr/bin/google-chrome-stable
|
|
|
|
| 7 |
|
| 8 |
-
# Install
|
| 9 |
RUN apt-get update \
|
| 10 |
&& apt-get install -y --no-install-recommends \
|
| 11 |
ca-certificates \
|
|
@@ -29,9 +29,11 @@ RUN apt-get update \
|
|
| 29 |
libxext6 \
|
| 30 |
libxshmfence1 \
|
| 31 |
libglib2.0-0 \
|
|
|
|
|
|
|
| 32 |
&& rm -rf /var/lib/apt/lists/*
|
| 33 |
|
| 34 |
-
# Add Google
|
| 35 |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
| 36 |
| gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \
|
| 37 |
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
|
|
@@ -40,9 +42,7 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
|
| 40 |
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
| 41 |
&& rm -rf /var/lib/apt/lists/*
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
# Copy and install Python dependencies
|
| 46 |
COPY requirements.txt /app/requirements.txt
|
| 47 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 48 |
&& pip install --no-cache-dir -r /app/requirements.txt
|
|
@@ -50,9 +50,9 @@ RUN pip install --no-cache-dir --upgrade pip \
|
|
| 50 |
# Copy app code
|
| 51 |
COPY . /app
|
| 52 |
|
| 53 |
-
# Expose port
|
| 54 |
EXPOSE 7860
|
| 55 |
|
| 56 |
-
#
|
| 57 |
-
#
|
| 58 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Dockerfile
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
|
|
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
ENV CHROME_BIN=/usr/bin/google-chrome-stable
|
| 6 |
+
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Install runtime deps required by Chrome
|
| 9 |
RUN apt-get update \
|
| 10 |
&& apt-get install -y --no-install-recommends \
|
| 11 |
ca-certificates \
|
|
|
|
| 29 |
libxext6 \
|
| 30 |
libxshmfence1 \
|
| 31 |
libglib2.0-0 \
|
| 32 |
+
libdbus-1-3 \
|
| 33 |
+
libdrm2 \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
+
# Add Google's signing key via gpg and install Google Chrome stable
|
| 37 |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
| 38 |
| gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \
|
| 39 |
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
|
|
|
|
| 42 |
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
| 43 |
&& rm -rf /var/lib/apt/lists/*
|
| 44 |
|
| 45 |
+
# Copy requirements and install python packages
|
|
|
|
|
|
|
| 46 |
COPY requirements.txt /app/requirements.txt
|
| 47 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 48 |
&& pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
| 50 |
# Copy app code
|
| 51 |
COPY . /app
|
| 52 |
|
| 53 |
+
# Expose port
|
| 54 |
EXPOSE 7860
|
| 55 |
|
| 56 |
+
# Start the app (run as root for easier Chrome in containers). If you want non-root,
|
| 57 |
+
# change and adjust permissions/flags accordingly.
|
| 58 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|