Skip to content

Instantly share code, notes, and snippets.

@joelongstreet
Last active December 13, 2017 13:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelongstreet/a7a8d9c6d5d4d1840eb7327213b34849 to your computer and use it in GitHub Desktop.
Save joelongstreet/a7a8d9c6d5d4d1840eb7327213b34849 to your computer and use it in GitHub Desktop.
Resin.io DockerFile - Node, Bower, Chromium
FROM resin/%%RESIN_MACHINE_NAME%%-node:6.9.1
RUN apt-get update \
&& apt-get install -y \
chromium-browser \
fbset \
htop \
libnss3 \
libraspberrypi-bin \
lsb-release\
matchbox \
psmisc \
sqlite3 \
ttf-mscorefonts-installer \
x11-xserver-utils \
xserver-xorg \
xinit \
xwit
RUN mkdir -p /usr/src/app \
&& ln -s /usr/src/app /app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN echo "allowed_users=anybody" > /etc/X11/Xwrapper.config
CMD bash -C "/app/spawn_screen";"bash"
#!/bin/bash
#Libraries need a ldconfig
ldconfig
echo $URL > /usr/src/app/url.txt
useradd -m pi
gpasswd -a pi video
cp /app/xinitrc /home/pi/.xinitrc;
chown pi: /home/pi/.xinitrc
su - pi -c startx &
#!/bin/bash
while true; do
# Clean up previously running apps, gracefully at first then harshly
killall -TERM chromium 2>/dev/null;
killall -TERM matchbox-window-manager 2>/dev/null;
sleep 2;
killall -9 chromium 2>/dev/null;
killall -9 matchbox-window-manager 2>/dev/null;
# Clean out existing profile information
rm -rf /home/pi/.cache;
rm -rf /home/pi/.config;
rm -rf /home/pi/.pki;
# Generate the bare minimum to keep Chromium happy!
mkdir -p /home/pi/.config/chromium/Default
sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version','46'); CREATE TABLE keywords (foo INTEGER);";
# Disable DPMS / Screen blanking
xset -dpms
xset s off
# Reset the framebuffer's colour-depth
fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth );
# Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction)
xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight )
# Start the window manager (remove "-use_cursor no" if you actually want mouse interaction)
matchbox-window-manager -use_titlebar no -use_cursor no &
# Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/)
chromium --app=$( cat /usr/src/app/url.txt )
done;
@webartistse
Copy link

Exactly what I was looking for! But this didn't work out of the box. Error:
rse_vt_settings: Cannot open /dev/tty0 (Permission denied)

If I add: gpasswd -a pi tty
I get:
f86OpenConsole: Cannot open virtual console 2 (Permission denied)

Have been sreaching but without any answer. Try xrandr but getting "Cant open display".
I have a HDMI Display and I can see Resin boot screen but after boot its just black.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment