-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
134 lines (109 loc) · 4.84 KB
/
Copy pathDockerfile
File metadata and controls
134 lines (109 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Built for DSRI - optimized Ubuntu VNC lxde-core image: ubuntu:22.04
# Based on original work from https://github.com/vemonet/docker-ubuntu-vnc-desktop/
################################################################################
# base system
################################################################################
ARG BASE_IMAGE=ubuntu:22.04
FROM $BASE_IMAGE AS system
RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
# built-in packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt install -y --no-install-recommends software-properties-common curl apache2-utils \
&& apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
supervisor nginx sudo net-tools zenity xz-utils \
dbus-x11 x11-utils alsa-utils \
mesa-utils libgl1-mesa-dri \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*
#Remove snap
### Prevent Snap from ever being installed (APT Pinning)
RUN echo 'Package: snapd\nPin: release a=*\nPin-Priority: -10' > /etc/apt/preferences.d/nosnap && \
apt-get update && \
apt-get purge -y snapd || true && \
apt-get autoremove -y
#Firefox
###Install GPG and Add Mozilla PPA
RUN apt-get update && apt-get install -y --no-install-recommends \
gnupg2 \
software-properties-common \
&& add-apt-repository -y ppa:mozillateam/ppa \
###Set Pinning: Tell Ubuntu to prefer the PPA version over the Snap version
&& echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox \
&& echo 'Pin: release o=LP-PPA-mozillateam' >> /etc/apt/preferences.d/mozilla-firefox \
&& echo 'Pin-Priority: 1001' >> /etc/apt/preferences.d/mozilla-firefox \
###Install the actual Firefox binary
&& apt-get update \
&& apt-get install -y --no-install-recommends firefox \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# VNC and basic tools
RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
xvfb x11vnc python3-websockify \
vim-tiny fonts-ubuntu fonts-wqy-zenhei \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Desktop environemnt (lxde-core)
RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
lxde-core lxterminal gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# tini to fix subreap
ARG TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
RUN chmod +x /bin/tini
# python library for web backend
COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/
RUN apt-get update \
&& dpkg-query -W -f='${Package}\n' > /tmp/a.txt \
&& apt-get install -y python3-pip python3-dev build-essential \
&& pip3 install setuptools wheel \
&& pip3 install -r /tmp/requirements.txt \
&& ln -s /usr/bin/python3 /usr/local/bin/python \
&& dpkg-query -W -f='${Package}\n' > /tmp/b.txt \
&& apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt
################################################################################
# builder
################################################################################
FROM $BASE_IMAGE AS builder
RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg patch
# nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs
# yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn
# build frontend
COPY web /src/web
RUN cd /src/web \
&& yarn \
&& yarn build
################################################################################
# merge
################################################################################
FROM system
LABEL maintainer="Maastricht University - RCS "
COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/
COPY rootfs /
EXPOSE 80
WORKDIR /root
# Create the folder where DSRI storage will be mounted
RUN mkdir -p /root/persistent
ENV HOME=/home/ubuntu \
SHELL=/bin/bash
HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health
RUN chmod +x /startup.sh
ENTRYPOINT ["/startup.sh"]