feat : updating with latest docker backend build thx to #265
This commit is contained in:
+86
-57
@@ -1,67 +1,100 @@
|
||||
FROM --platform=linux/amd64 ubuntu:22.04
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
FROM --platform=linux/amd64 python:3.11-slim
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install essential packages and Chrome dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
RUN apt-get update -y && apt-get install -y \
|
||||
wget \
|
||||
gnupg2 \
|
||||
ca-certificates \
|
||||
unzip \
|
||||
curl \
|
||||
gnupg \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
python3-wheel \
|
||||
build-essential \
|
||||
xvfb \
|
||||
libxss1 \
|
||||
libappindicator1 \
|
||||
fonts-liberation \
|
||||
libasound-dev \
|
||||
libasound2 \
|
||||
portaudio19-dev \
|
||||
libnss3 \
|
||||
libatk1.0-0 \
|
||||
libatk-bridge2.0-0 \
|
||||
libcups2 \
|
||||
libdrm2 \
|
||||
libxcomposite1 \
|
||||
libxdamage1 \
|
||||
libfontconfig1 \
|
||||
libxrandr2 \
|
||||
libgbm1 \
|
||||
libxss1 \
|
||||
libnss3 \
|
||||
libnspr4 \
|
||||
libxshmfence1 \
|
||||
libgconf-2-4 \
|
||||
libxfixes3 \
|
||||
libxinerama1 \
|
||||
libgtk-3-0 \
|
||||
libgdk-pixbuf2.0-0 \
|
||||
libatspi2.0-0 \
|
||||
libdrm2 \
|
||||
libxkbcommon0 \
|
||||
libepoxy0 \
|
||||
libgtk-3-0 \
|
||||
libharfbuzz0b \
|
||||
libegl1-mesa \
|
||||
libgles2-mesa \
|
||||
# Virtual display for headless operation
|
||||
xvfb \
|
||||
xdg-utils \
|
||||
dbus \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip3 install --upgrade pip setuptools wheel && \
|
||||
pip3 install selenium
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y \
|
||||
gcc \
|
||||
g++ \
|
||||
gfortran \
|
||||
libportaudio2 \
|
||||
portaudio19-dev \
|
||||
ffmpeg \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
gnupg2 \
|
||||
wget \
|
||||
unzip \
|
||||
python3 \
|
||||
python3-pip \
|
||||
libasound2 \
|
||||
libatk-bridge2.0-0 \
|
||||
libgtk-4-1 \
|
||||
libnss3 \
|
||||
xdg-utils \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y \
|
||||
alsa-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV CHROME_TESTING_VERSION=134.0.6998.88
|
||||
ENV DISPLAY=:99
|
||||
|
||||
RUN set -eux; \
|
||||
wget -qO /tmp/chrome.zip \
|
||||
"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chrome-linux64.zip"; \
|
||||
unzip -q /tmp/chrome.zip -d /opt; \
|
||||
rm /tmp/chrome.zip; \
|
||||
ln -s /opt/chrome-linux64/chrome /usr/local/bin/google-chrome; \
|
||||
ln -s /opt/chrome-linux64/chrome /usr/local/bin/chrome; \
|
||||
mkdir -p /opt/chrome; \
|
||||
ln -s /opt/chrome-linux64/chrome /opt/chrome/chrome; \
|
||||
google-chrome --version
|
||||
|
||||
RUN set -eux; \
|
||||
wget -qO /tmp/chromedriver.zip \
|
||||
"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chromedriver-linux64.zip"; \
|
||||
unzip -q /tmp/chromedriver.zip -d /tmp; \
|
||||
mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin; \
|
||||
rm /tmp/chromedriver.zip; \
|
||||
chmod +x /usr/local/bin/chromedriver; \
|
||||
chromedriver --version
|
||||
|
||||
RUN chmod +x /opt/chrome/chrome
|
||||
|
||||
RUN pip3 install --upgrade pip setuptools wheel
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN mkdir -p /opt/workspace
|
||||
|
||||
# Copy application code
|
||||
COPY api.py .
|
||||
# Chrome bundle approach, commented out opting for direct download
|
||||
#COPY chrome_bundle/ ./chrome_bundle/
|
||||
COPY sources/ ./sources/
|
||||
COPY prompts/ ./prompts/
|
||||
COPY crx/ crx/
|
||||
COPY llm_router/ llm_router/
|
||||
RUN ls
|
||||
COPY .env.example .env
|
||||
COPY config.ini .
|
||||
|
||||
# Install Chrome and ChromeDriver from chrome-for-testing
|
||||
#RUN wget -O chrome-headless-shell-linux64.zip https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chrome-headless-shell-linux64.zip && \
|
||||
@@ -75,24 +108,20 @@ COPY .env.example .env
|
||||
# chmod +x /opt/google/chrome/chrome-headless-shell && \
|
||||
# chmod +x /usr/local/bin/chromedriver
|
||||
|
||||
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
||||
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y google-chrome-stable && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
#RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
||||
# echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \
|
||||
# apt-get update && \
|
||||
# apt-get install -y google-chrome-stable && \
|
||||
# rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
## Install matching ChromeDriver
|
||||
#RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') && \
|
||||
# wget -O chromedriver.zip "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION%%.*}/chromedriver_linux64.zip" && \
|
||||
# unzip chromedriver.zip && \
|
||||
# mv chromedriver /usr/local/bin/ && \
|
||||
# chmod +x /usr/local/bin/chromedriver && \
|
||||
# rm chromedriver.zip
|
||||
|
||||
# Install matching ChromeDriver
|
||||
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') && \
|
||||
wget -O chromedriver.zip "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION%%.*}/chromedriver_linux64.zip" && \
|
||||
unzip chromedriver.zip && \
|
||||
mv chromedriver /usr/local/bin/ && \
|
||||
chmod +x /usr/local/bin/chromedriver && \
|
||||
rm chromedriver.zip
|
||||
|
||||
ENV DISPLAY=:99
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the application
|
||||
CMD ["python3", "api.py"]
|
||||
Reference in New Issue
Block a user