Skip to content

Commit 354b745

Browse files
author
Sebastian Limbach
committed
Added Docker support
1 parent 8010e62 commit 354b745

File tree

6 files changed

+121
-3
lines changed

6 files changed

+121
-3
lines changed

Diff for: .dockerignore

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Various Node ignoramuses.
2+
3+
logs
4+
*.log
5+
npm-debug.log*
6+
pids
7+
*.pid
8+
*.seed
9+
lib-cov
10+
coverage
11+
.grunt
12+
.lock-wscript
13+
build/Release
14+
node_modules
15+
jspm_modules
16+
.npm
17+
.node_repl_history
18+
19+
# Various Windows ignoramuses.
20+
Thumbs.db
21+
ehthumbs.db
22+
Desktop.ini
23+
$RECYCLE.BIN/
24+
*.cab
25+
*.msi
26+
*.msm
27+
*.msp
28+
*.lnk
29+
30+
# Various OSX ignoramuses.
31+
.DS_Store
32+
.AppleDouble
33+
.LSOverride
34+
Icon
35+
._*
36+
.DocumentRevisions-V100
37+
.fseventsd
38+
.Spotlight-V100
39+
.TemporaryItems
40+
.Trashes
41+
.VolumeIcon.icns
42+
.AppleDB
43+
.AppleDesktop
44+
Network Trash Folder
45+
Temporary Items
46+
.apdisk
47+
48+
# Various Linux ignoramuses.
49+
50+
.fuse_hidden*
51+
.directory
52+
.Trash-*
53+
54+
# Various Magic Mirror ignoramuses and anti-ignoramuses.
55+
56+
# Don't ignore the node_helper core module.
57+
!/modules/node_helper
58+
!/modules/node_helper/**
59+
60+
# Ignore all modules except the default modules.
61+
/modules/**
62+
!/modules/default/**
63+
64+
# Ignore changes to the custom css files.
65+
/css/custom.css
66+
67+
# Ignore unnecessary files for docker
68+
CHANGELOG.md
69+
LICENSE.md
70+
README.md
71+
Gruntfile.js
72+
.*

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Temporary Items
5353

5454
# Various Magic Mirror ignoramuses and anti-ignoramuses.
5555

56-
# Don't ignore the node_helper nore module.
56+
# Don't ignore the node_helper core module.
5757
!/modules/node_helper
5858
!/modules/node_helper/**
5959

Diff for: Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:latest
2+
3+
WORKDIR /opt/magic_mirror
4+
COPY . .
5+
COPY /modules unmount_modules
6+
COPY /config unmount_config
7+
8+
ENV NODE_ENV production
9+
ENV MM_PORT 8080
10+
11+
RUN npm install
12+
RUN ["chmod", "+x", "docker-entrypoint.sh"]
13+
14+
EXPOSE $MM_PORT
15+
ENTRYPOINT ["/opt/magic_mirror/docker-entrypoint.sh"]

Diff for: README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,28 @@ curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installer
4646
**Note:** if you want to debug on Raspberry Pi you can use `npm start dev` which will start the MagicMirror app with Dev Tools enabled.
4747

4848
### Server Only
49+
In some cases, you want to start the application without an actual app window. In this case, you can start MagicMirror² in server only mode. This will start the server, after which you can open the application in your browser of choice.
4950

50-
In some cases, you want to start the application without an actual app window. In this case, execute the following command from the MagicMirror folder: `node serveronly`. This will start the server, after which you can open the application in your browser of choice.
51+
#### Docker
52+
53+
The simplest way to start MagicMirror² in server only mode is using [Docker](https://docker.com). After a successful [Docker installation](https://docs.docker.com/engine/installation/) you just need to execute the following command in the shell:
54+
55+
```bash
56+
docker run -d \
57+
--publish 80:8080 \
58+
--restart always \
59+
--volume ~/Documents/docker_volumes/mm/config:/opt/magic_mirror/config \
60+
--volume ~/Documents/docker_volumes/mm/modules:/opt/magic_mirror/modules \
61+
--name magic_mirror \
62+
magic_mirror
63+
```
64+
65+
#### Manual
66+
67+
1. Download and install the latest Node.js version.
68+
2. Clone the repository and check out the beta branch: `git clone https://github.com/MichMich/MagicMirror`
69+
3. Enter the repository: `cd ~/MagicMirror`
70+
4. Install and run the app: `node serveronly`
5171

5272
### Raspberry Configuration & Auto Start.
5373

Diff for: docker-entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
if [ ! -f /opt/magic_mirror/modules ]; then
4+
cp -R /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules
5+
fi
6+
7+
if [ ! -f /opt/magic_mirror/config ]; then
8+
cp -R /opt/magic_mirror/unmount_config/. /opt/magic_mirror/config
9+
fi
10+
11+
node serveronly

Diff for: js/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
var defaults = {
11-
port: 8080,
11+
port: process.env.MM_PORT || 8080,
1212
kioskmode: false,
1313
electronOptions: {},
1414
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],

0 commit comments

Comments
 (0)