forked from balena-io-experimental/browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
47 lines (34 loc) · 1.42 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
ARG NODEJS_VERSION="16.19.1"
FROM balenalib/raspberrypi3-debian-node:${NODEJS_VERSION}-bullseye-run
# install required packages
RUN install_packages \
chromium-common \
chromium \
lsb-release \
scrot
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
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
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 .
ENV DISPLAY=:0
# Start app
RUN sed -i -e 's/\r$//' /usr/src/app/start.sh
CMD ["bash", "/usr/src/app/start.sh"]