From 0431731be94c1308d019ac520266e1977531ea4d Mon Sep 17 00:00:00 2001 From: Julius Jacobitz <47418007+JuliusJacobitz@users.noreply.github.com> Date: Wed, 9 Jun 2021 16:36:30 +0200 Subject: [PATCH] Add Docker Support --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ README.md | 1 + tools/its.py | 5 ++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7e2455ec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM debian:buster + +# install apt dependencies +RUN apt-get update -y +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales chromium=90.0.4430.212-1~deb10u1 chromium-driver=90.0.4430.212-1~deb10u1 python3 python3-pip python-websockify git xorg vnc4server autocutsel lxde-core novnc +RUN pip3 install --upgrade pip + +RUN sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=de_DE.UTF-8 + +ENV LANG de_DE.UTF-8 + +WORKDIR /app + +ENV VACCIPY_CHROMEDRIVER="/usr/bin/chromedriver" + +# copy whole folder into container +COPY . . + +RUN pip3 install -r requirements.txt + +# setup vnc +RUN echo "# XScreenSaver Preferences File\nmode: off\nselected: -1" > /root/.xscreensaver && \ + cat /root/.xscreensaver && mkdir /root/.vnc/ && \ + echo "#!/bin/sh\n/usr/bin/autocutsel -s CLIPBOARD -fork\nxrdb $HOME/.Xresources\nxsetroot -solid grey\n#x-terminal-emulator -geometry 80x24+10+10 -ls -title \"$VNCDESKTOP Desktop\" &\n#x-window-manager &\n# Fix to make GNOME work\nexport XKL_XMODMAP_DISABLE=1\n/etc/X11/Xsession &\nx-terminal-emulator -e \"python3 /app/main.py search -f /app/kontaktdaten.json 2>&1 | tee /app/vaccipy\"" > /root/.vnc/xstartup && \ + chmod +x /root/.vnc/xstartup && \ + cat /root/.vnc/xstartup && \ + mv /usr/share/novnc/vnc.html /usr/share/novnc/index.html && \ + echo "#!/bin/bash\nsetxkbmap -option lv3:rwin_switch\necho -n \${VNC_PASSWORD:-vaccipy} | vncpasswd -f > /root/.vnc/passwd\nchmod 400 ~/.vnc/passwd\n\nexport USER=root\nvncserver -localhost no :1 -geometry 1920x1080 -depth 24 -rfbport \${VNC_PORT:-5901} && websockify -D --web=/usr/share/novnc/ \${WEB_PORT:-6901} localhost:\${VNC_PORT:-5901} \ntail -f /app/vaccipy" > /root/vnc-startup.sh && \ + chmod +x /root/vnc-startup.sh && \ + cat /root/vnc-startup.sh && \ + chmod go-rwx /root/.vnc + +CMD ["/root/vnc-startup.sh"] diff --git a/README.md b/README.md index 27498f3a..1f88a213 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,7 @@ werden (von uns oder euch - feel free!) irgendwann hinzukommen: - [ ] Datum eingrenzen bei der Terminwahl - [ ] Github Pages +- [ ] Integrierter updater. - [ ] Macosx Build / Pipeline (Mac currently blocks the app: [Branch](https://github.com/iamnotturner/vaccipy/tree/mac-intel-build)) - [ ] Code Zertifikate für Windows (gegen Virusmeldung) diff --git a/tools/its.py b/tools/its.py index d36db2b5..40310db3 100644 --- a/tools/its.py +++ b/tools/its.py @@ -186,6 +186,9 @@ def get_chromedriver(self, headless): # deaktiviere Selenium Logging chrome_options.add_argument('disable-infobars') + chrome_options.add_argument("--headless") + chrome_options.add_argument("--no-sandbox") + chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_experimental_option('useAutomationExtension', False) chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"]) chrome_options.add_experimental_option('excludeSwitches', ['enable-logging']) @@ -204,7 +207,7 @@ def get_chromedriver(self, headless): chrome_options.headless = headless - return Chrome(self.get_chromedriver_path(), options=chrome_options) + return Chrome(options=chrome_options) def driver_enter_code(self, driver, plz_impfzentrum): """