forked from balena-io-experimental/browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.template
60 lines (44 loc) · 1.75 KB
/
Dockerfile.template
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
ARG NODEJS_VERSION="16.19.1"
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:${NODEJS_VERSION}-bullseye-run
# install required packages
RUN install_packages \
chromium-common \
chromium \
libgles2-mesa \
lsb-release \
mesa-vdpau-drivers \
scrot \
x11-xserver-utils \
xserver-xorg-input-evdev \
xserver-xorg-legacy \
xserver-xorg-video-fbdev \
xserver-xorg xinit \
xinput \
xterm
WORKDIR /usr/src/app
# install node dependencies
COPY ./package.json /usr/src/app/package.json
RUN JOBS=MAX npm install --unsafe-perm --production && npm cache clean --force
COPY ./src /usr/src/app/
RUN chmod +x ./*.sh
ENV UDEV=1
RUN mkdir -p /etc/chromium/policies
RUN mkdir -p /etc/chromium/policies/recommended
COPY ./policy.json /etc/chromium/policies/recommended/my_policy.json
# Add chromium user
RUN useradd chromium -m -s /bin/bash -G root || true && \
groupadd -r -f chromium && id -u chromium || true \
&& chown -R chromium:chromium /home/chromium || true
COPY ./public-html /home/chromium
# udev rule to set specific permissions
RUN echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
RUN usermod -a -G audio,video,tty chromium
# Add brightness control permissions
RUN echo 'SUBSYSTEM=="backlight", RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness"' >> /etc/udev/rules.d/90-backlight.rules
RUN ln -s /usr/bin/chromium /usr/bin/chromium-browser || true
# Set up the audio block. This won't have any effect if the audio block is not being used.
RUN curl -skL https://raw.githubusercontent.com/balena-labs-projects/audio/master/scripts/alsa-bridge/debian-setup.sh| sh
ENV PULSE_SERVER=tcp:audio:4317
COPY VERSION .
# Start app
CMD ["bash", "/usr/src/app/start.sh"]