Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raspberry pi - install & use magicmirror under docker #2

Open
lpt2007 opened this issue Feb 4, 2019 · 0 comments
Open

raspberry pi - install & use magicmirror under docker #2

lpt2007 opened this issue Feb 4, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@lpt2007
Copy link
Owner

lpt2007 commented Feb 4, 2019

I used raspbian-desktop from this link:
https://www.raspberrypi.org/downloads/raspbian/

I enabled ssh with:

sudo systemctl enable ssh

I update host system:

sudo apt-get -y update
sudo apt-get -y upgrade

run raspi-config:
sudo raspi-config

go to -> "Interfacing Options" -> "Camera" -> Enable,
go to -> "Advanced Options" -> "Memory Split" -> 256
go to -> "Finish" -> "Reboot"

I installed docker:

curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
sudo usermod -aG docker pi

I Installed x11docker:

wget https://raw.githubusercontent.com/mviereck/x11docker/master/x11docker -O /tmp/x11docker
sudo bash /tmp/x11docker --update
rm /tmp/x11docker

I create folders:

mkdir /home/pi/docker
mkdir /home/pi/docker/magicmirror

create and edit Dockerfile:
nano /home/pi/docker/magicmirror/Dockerfile

add this:

FROM hypriot/rpi-node:latest

ENV NODE_ENV production

WORKDIR /opt/magic_mirror

RUN git clone --depth 1 -b master https://github.com/MichMich/MagicMirror.git .

RUN cp -R modules /opt/default_modules
RUN cp -R config /opt/default_config
RUN npm install --unsafe-perm --silent

COPY docker-entrypoint.sh /opt
RUN apt-get update \
  && apt-get -qy install dos2unix \
  && dos2unix /opt/docker-entrypoint.sh \
  && chmod +x /opt/docker-entrypoint.sh

RUN apt-get -y install libgtk-3-0
RUN apt-get -y install libx11-xcb-dev
RUN apt-get -y install libxtst6
RUN apt-get -y install libxss1
RUN apt-get -y install libgconf-2-4
RUN apt-get -y install libnss3
RUN apt-get -y install libasound2

EXPOSE 8080
CMD ["npm start"]
ENTRYPOINT ["/opt/docker-entrypoint.sh"]

create and edit Dockerfile:
nano /home/pi/docker/magicmirror/docker-entrypoint.sh

add this:

#!/bin/bash

if [ ! -f /opt/magic_mirror/modules ]; then
    cp -Rn /opt/default_modules/. /opt/magic_mirror/modules
fi

if [ ! -f /opt/magic_mirror/config ]; then
    cp -Rn /opt/default_config/. /opt/magic_mirror/config
fi

$@

build docker container:
sudo docker build -t magicmirror /home/pi/docker/magicmirror

from ssh I run this:

sudo x11docker --user=root --xorg magicmirror
@lpt2007 lpt2007 added the enhancement New feature or request label Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant