Skip to content

Commit

Permalink
Merge pull request #846 from bastilimbach/develop
Browse files Browse the repository at this point in the history
Add the ability to use the docker image with a raspberry pi
  • Loading branch information
MichMich committed Apr 12, 2017
2 parents eae21e1 + 4f844ab commit f45bd18
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 18 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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** |
Expand Down
4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#!/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
Expand Down

0 comments on commit f45bd18

Please sign in to comment.