From d5e902679b45e64c88b18cd23f227c83e141410c Mon Sep 17 00:00:00 2001 From: Sebastian Limbach Date: Wed, 12 Apr 2017 20:19:24 +0200 Subject: [PATCH 1/3] Change linux distribution I changed the linux distribution from node, which used Debian, to an arm based linux distribution so the application can be used on an arm based system (e.g. Raspberry) --- Dockerfile | 31 ++++++++++++++++++------------- README.md | 2 +- docker-entrypoint.sh | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32939f9599..4ee863fb46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,27 @@ -FROM node:latest +FROM izone/arm:node +# Set env variables ENV NODE_ENV production ENV MM_PORT 8080 + WORKDIR /opt/magic_mirror -COPY . . -COPY /modules unmount_modules -COPY /config unmount_config +# Cache node_modules +COPY package.json /opt/magic_mirror +RUN npm install + +# Copy all needed files +COPY . /opt/magic_mirror + +# Save/Cache config and modules folder for docker-entrypoint +COPY /modules /opt/magic_mirror/unmount_modules +COPY /config /opt/magic_mirror/unmount_config -RUN apt-get update \ - && apt-get -qy install tofrodos dos2unix \ - && chmod -R 777 vendor \ - && npm install \ - && cd vendor \ - && npm install \ - && cd .. \ - && dos2unix docker-entrypoint.sh \ - && chmod +x docker-entrypoint.sh +# Convert docker-entrypoint.sh to unix format and grant execution privileges +RUN apk update \ + && apk add dos2unix --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + && dos2unix docker-entrypoint.sh \ + && chmod +x docker-entrypoint.sh EXPOSE $MM_PORT ENTRYPOINT ["/opt/magic_mirror/docker-entrypoint.sh"] diff --git a/README.md b/README.md index 4fd480bffa..29e5b65f09 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ docker run -d \ --volume ~/magic_mirror/config:/opt/magic_mirror/config \ --volume ~/magic_mirror/modules:/opt/magic_mirror/modules \ --name magic_mirror \ - MichMich/MagicMirror + michmich/magicmirror ``` | **Volumes** | **Description** | diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 5d37b4a600..91d7ebc7da 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if [ ! -f /opt/magic_mirror/modules ]; then cp -R /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules From b688dcd4ba75d2d93d757b82a4c787fd2c8801de Mon Sep 17 00:00:00 2001 From: Sebastian Limbach Date: Wed, 12 Apr 2017 20:20:30 +0200 Subject: [PATCH 2/3] Add changes to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ece1e3775..675db64592 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [2.1.2] - Unreleased ### Changed +- Change Docker base image (Debian + Node) to an arm based distro (AlpineARM + Node) ([#846](https://github.com/MichMich/MagicMirror/pull/846)) - Fix the dockerfile to have it running from the first time. ### Added From 4f844abc0c795d9ebf280010743b7d0c39a17a91 Mon Sep 17 00:00:00 2001 From: Sebastian Limbach Date: Wed, 12 Apr 2017 20:21:51 +0200 Subject: [PATCH 3/3] Change copy flag to not replace existing modules --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 91d7ebc7da..3ab9750210 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh if [ ! -f /opt/magic_mirror/modules ]; then - cp -R /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules + cp -Rn /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules fi if [ ! -f /opt/magic_mirror/config ]; then