dirty patch for retrying more time nodriver + remove some dependencies

This commit is contained in:
Emilien Devos 2024-07-21 17:47:18 +02:00
parent c7ea8d6dfb
commit 0551c92227
2 changed files with 9 additions and 21 deletions

View file

@ -3,8 +3,6 @@ FROM python:3.12-alpine
# Install dependencies
RUN apk add --no-cache \
xvfb \
x11vnc \
fluxbox \
nss \
freetype \
freetype-dev \
@ -14,16 +12,14 @@ RUN apk add --no-cache \
chromium \
chromium-chromedriver
# Install x11vnc
RUN mkdir ~/.vnc
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
WORKDIR /usr/app/src
COPY index.py requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY docker/scripts/startup.sh ./
RUN sed -i 's/await self.sleep(0.5)/await self.sleep(2)/' /usr/local/lib/python3.12/site-packages/nodriver/core/browser.py
# Run
CMD [ "./startup.sh"]

View file

@ -2,21 +2,13 @@
echo "[INFO] internally launching GUI (X11 environment)"
rm -f /tmp/.X0-lock
XVFB_WHD=${XVFB_WHD:-1280x720x16}
# Run Xvfb on display 0.
Xvfb :0 -screen 0 1280x720x16 &>/dev/null &
echo "[INFO] starting Xvfb"
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &
sleep 2
# Run fluxbox windows manager on display 0.
fluxbox -display :0 &>/dev/null &
# Run x11vnc on display 0
x11vnc -display :0 -forever -usepw &>/dev/null &
# Add delay
sleep 5
echo "[INFO] launching the python script"
echo "[INFO] launching chromium instance"
# Run python script on display 0
DISPLAY=:0 python index.py
DISPLAY=:99 python index.py