jammss commited on
Commit
2cbdb1f
·
verified ·
1 Parent(s): 08f8787

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +87 -34
Dockerfile CHANGED
@@ -1,34 +1,87 @@
1
- FROM python:3.10
2
-
3
- # Install git and node
4
- RUN apt-get update && apt-get install -y git nodejs npm
5
-
6
- WORKDIR /srv
7
- COPY ./requirements.txt .
8
-
9
- COPY ./app.py /srv/app.py
10
- COPY ./api /srv/api
11
- COPY ./static /srv/static
12
- COPY ./templates /srv/templates
13
- COPY ./web /srv/web
14
- COPY ./assets /srv/assets
15
-
16
- # TODO: this is monkey-patch for check_update() function, should be disabled in Docker
17
- COPY ./.git /srv/.git
18
-
19
- VOLUME [ "/data" ]
20
-
21
- # Monkey-patch (1): because "binding_zoo" installs the packets inside venv, we cannot do pip install on build time
22
- # Monkey-patch (2): send an "enter" keystroke to python to confirm the first launch process
23
- CMD ["/bin/bash", "-c", " \
24
- apt-get update && apt-get install -y git nodejs npm; \
25
- python -m venv /data/venv; \
26
- source /data/venv/bin/activate; \
27
- python -m pip install --no-cache-dir -r requirements.txt --upgrade pip; \
28
- echo -ne '\n' | \
29
- python app.py \
30
- --host 0.0.0.0 \
31
- --port 9600 \
32
- --db_path /data/Documents/databases/database.db \
33
- --config /configs/config.yaml \
34
- "]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:20.04
2
+
3
+ # prevent interactive prompts
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # update dependencies
7
+ RUN apt update
8
+ RUN apt upgrade -y
9
+
10
+ # install xfce desktop
11
+ RUN apt install -y xfce4 xfce4-goodies
12
+
13
+ # install dependencies
14
+ RUN apt install -y \
15
+ tightvncserver \
16
+ novnc \
17
+ net-tools \
18
+ nano \
19
+ vim \
20
+ neovim \
21
+ curl \
22
+ wget \
23
+ firefox \
24
+ git \
25
+ python3 \
26
+ python3-pip
27
+
28
+ # xfce fixes
29
+ RUN update-alternatives --set x-terminal-emulator /usr/bin/xfce4-terminal.wrapper
30
+
31
+ # setup Chromium
32
+ RUN git clone https://github.com/scheib/chromium-latest-linux.git /chromium
33
+ RUN /chromium/update.sh
34
+
35
+ # VNC and noVNC config
36
+ ARG USER=root
37
+ ENV USER=${USER}
38
+
39
+ ARG VNCPORT=5900
40
+ ENV VNCPORT=${VNCPORT}
41
+ EXPOSE ${VNCPORT}
42
+
43
+ ARG NOVNCPORT=9090
44
+ ENV NOVNCPORT=${NOVNCPORT}
45
+ EXPOSE ${NOVNCPORT}
46
+
47
+ ARG VNCPWD=changeme
48
+ ENV VNCPWD=${VNCPWD}
49
+
50
+ ARG VNCDISPLAY=1920x1080
51
+ ENV VNCDISPLAY=${VNCDISPLAY}
52
+
53
+ ARG VNCDEPTH=16
54
+ ENV VNCDEPTH=${VNCDEPTH}
55
+
56
+ # setup VNC
57
+ RUN mkdir -p /root/.vnc/
58
+ RUN echo ${VNCPWD} | vncpasswd -f > /root/.vnc/passwd
59
+ RUN chmod 600 /root/.vnc/passwd
60
+ RUN echo "#!/bin/sh \n\
61
+ xrdb $HOME/.Xresources \n\
62
+ xsetroot -solid grey \n\
63
+ #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & \n\
64
+ #x-window-manager & \n\
65
+ # Fix to make GNOME work \n\
66
+ export XKL_XMODMAP_DISABLE=1 \n\
67
+ /etc/X11/Xsession \n\
68
+ startxfce4 & \n\
69
+ " > /root/.vnc/xstartup
70
+ RUN chmod +x /root/.vnc/xstartup
71
+
72
+ # setup noVNC
73
+ RUN openssl req -new -x509 -days 365 -nodes \
74
+ -subj "/C=US/ST=IL/L=Springfield/O=OpenSource/CN=localhost" \
75
+ -out /etc/ssl/certs/novnc_cert.pem -keyout /etc/ssl/private/novnc_key.pem \
76
+ > /dev/null 2>&1
77
+ RUN cat /etc/ssl/certs/novnc_cert.pem /etc/ssl/private/novnc_key.pem \
78
+ > /etc/ssl/private/novnc_combined.pem
79
+ RUN chmod 600 /etc/ssl/private/novnc_combined.pem
80
+
81
+ ENTRYPOINT [ "/bin/bash", "-c", " \
82
+ echo 'NoVNC Certificate Fingerprint:'; \
83
+ openssl x509 -in /etc/ssl/certs/novnc_cert.pem -noout -fingerprint -sha256; \
84
+ vncserver :0 -rfbport ${VNCPORT} -geometry $VNCDISPLAY -depth $VNCDEPTH -localhost; \
85
+ /usr/share/novnc/utils/launch.sh --listen $NOVNCPORT --vnc localhost:$VNCPORT \
86
+ --cert /etc/ssl/private/novnc_combined.pem \
87
+ " ]