Update Dockerfile
Browse files- Dockerfile +8 -6
Dockerfile
CHANGED
|
@@ -3,16 +3,17 @@ FROM python:3.9-slim
|
|
| 3 |
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
ENV CHROME_BIN=/usr/bin/google-chrome-stable
|
| 6 |
-
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
# Install
|
| 10 |
RUN apt-get update \
|
| 11 |
&& apt-get install -y --no-install-recommends \
|
| 12 |
ca-certificates \
|
| 13 |
wget \
|
| 14 |
gnupg \
|
| 15 |
unzip \
|
|
|
|
|
|
|
| 16 |
fonts-liberation \
|
| 17 |
libnss3 \
|
| 18 |
libxss1 \
|
|
@@ -34,7 +35,7 @@ RUN apt-get update \
|
|
| 34 |
libdrm2 \
|
| 35 |
&& rm -rf /var/lib/apt/lists/*
|
| 36 |
|
| 37 |
-
# Add Google's signing key
|
| 38 |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
| 39 |
| gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \
|
| 40 |
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
|
|
@@ -43,15 +44,16 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
|
| 43 |
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
| 44 |
&& rm -rf /var/lib/apt/lists/*
|
| 45 |
|
| 46 |
-
#
|
| 47 |
COPY requirements.txt /app/requirements.txt
|
| 48 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 49 |
&& pip install --no-cache-dir -r /app/requirements.txt
|
| 50 |
|
| 51 |
-
# Copy
|
| 52 |
COPY . /app
|
| 53 |
|
|
|
|
| 54 |
EXPOSE 7860
|
| 55 |
|
| 56 |
-
#
|
| 57 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 3 |
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
ENV CHROME_BIN=/usr/bin/google-chrome-stable
|
|
|
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Install system packages needed for Chrome, Xvfb and general runtime.
|
| 9 |
RUN apt-get update \
|
| 10 |
&& apt-get install -y --no-install-recommends \
|
| 11 |
ca-certificates \
|
| 12 |
wget \
|
| 13 |
gnupg \
|
| 14 |
unzip \
|
| 15 |
+
xvfb \
|
| 16 |
+
x11-utils \
|
| 17 |
fonts-liberation \
|
| 18 |
libnss3 \
|
| 19 |
libxss1 \
|
|
|
|
| 35 |
libdrm2 \
|
| 36 |
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
| 38 |
+
# Add Google's signing key and install google-chrome-stable
|
| 39 |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
|
| 40 |
| gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \
|
| 41 |
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
|
|
|
|
| 44 |
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
| 45 |
&& rm -rf /var/lib/apt/lists/*
|
| 46 |
|
| 47 |
+
# Copy requirements and install python packages
|
| 48 |
COPY requirements.txt /app/requirements.txt
|
| 49 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 50 |
&& pip install --no-cache-dir -r /app/requirements.txt
|
| 51 |
|
| 52 |
+
# Copy application code
|
| 53 |
COPY . /app
|
| 54 |
|
| 55 |
+
# Expose port
|
| 56 |
EXPOSE 7860
|
| 57 |
|
| 58 |
+
# Run the app (runs as root for simplicity)
|
| 59 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|