-
Notifications
You must be signed in to change notification settings - Fork 55
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
Use smaller base image #46
Open
sthuber90
wants to merge
13
commits into
bastilimbach:master
Choose a base branch
from
sthuber90:minify-docker-image-size
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
00aff5b
replace buster with alpine
66eb48f
mark as executable
6e791ed
Create .dockerignore
991a098
add bin/bash shebang
eff0383
clean up file and minify copying between stages
61dfc31
don't cleanup apk packages in stage 0 (BUILD_IMAGE)
ca2ab3a
adding helper script
9b436a2
generating docker structure
05a0a00
remove obsolete Dockerfile
b51d1a7
:pencil: writing docs
5b6d1e9
updating scripts
6ca7b8f
:construction_worker: update travis build
4bef007
Update .travis.yml
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.github | ||
config | ||
modules | ||
build.sh | ||
test-build.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
FROM node:12-alpine AS BUILD_IMAGE | ||
|
||
ARG branch=master | ||
|
||
ENV NODE_ENV production | ||
WORKDIR /opt/magic_mirror | ||
|
||
# get magic mirror | ||
RUN apk update && apk add --no-cache git \ | ||
&& git clone --depth 1 -c advice.detachedHead=false -b ${branch} https://github.com/MichMich/MagicMirror.git . | ||
|
||
# save default modules and configuration and install dependencies | ||
RUN set -o pipefail \ | ||
&& mkdir dist \ | ||
&& cp -R config /opt/magic_mirror/dist/default_config \ | ||
&& cp -R modules /opt/magic_mirror/dist/default_modules \ | ||
&& npm set unsafe-perm true \ | ||
&& npm ci \ | ||
# removes required depdencies and should not be used | ||
# && npm prune --production --json \ | ||
# prune unnecessary files from ./node_modules, such as markdown, typescript source files, and so on. https://github.com/tj/node-prune | ||
&& wget -q https://install.goreleaser.com/github.com/tj/node-prune.sh | sh \ | ||
# it is intentional that modules are not copied to dist folder. Please keep alphabetically sorted | ||
&& cp -R \ | ||
.git \ | ||
config \ | ||
css \ | ||
fonts \ | ||
index.html \ | ||
js \ | ||
node_modules \ | ||
package.json \ | ||
package-lock.json \ | ||
serveronly \ | ||
translations \ | ||
vendor /opt/magic_mirror/dist | ||
|
||
|
||
FROM node:12-alpine | ||
|
||
WORKDIR /opt/magic_mirror | ||
|
||
RUN set -x \ | ||
&& apk update && apk add --no-cache git \ | ||
&& apk add --no-cache --update libintl \ | ||
&& apk add --no-cache --virtual build_deps gettext \ | ||
&& cp /usr/bin/envsubst /usr/local/bin/envsubst \ | ||
&& apk del build_deps \ | ||
&& mv /usr/local/bin/envsubst /usr/bin/envsubst | ||
|
||
COPY --from=BUILD_IMAGE /opt/magic_mirror/dist/ . | ||
|
||
EXPOSE 8080 | ||
|
||
COPY mm-docker-config.js docker-entrypoint.sh ./ | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
CMD ["node", "serveronly"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/modules)" ]; then | ||
cp -R /opt/magic_mirror/default_modules/. /opt/magic_mirror/modules | ||
fi | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/config)" ]; then | ||
cp /opt/magic_mirror/mm-docker-config.js /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
if [ -f "/opt/magic_mirror/config/config.js.template" ]; then | ||
envsubst < /opt/magic_mirror/config/config.js.template > /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* Magic Mirror Config Sample | ||
* | ||
* By Michael Teeuw http://michaelteeuw.nl | ||
* MIT Licensed. | ||
* | ||
* For more information how you can configurate this file | ||
* See https://github.com/MichMich/MagicMirror#configuration | ||
* | ||
*/ | ||
|
||
var config = { | ||
address: "0.0.0.0", // Address to listen on, can be: | ||
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface | ||
// - another specific IPv4/6 to listen on a specific interface | ||
// - "0.0.0.0" to listen on any interface | ||
// Default, when address config is left out, is "localhost" | ||
port: 8080, | ||
ipWhitelist: [], // Set [] to allow all IP addresses | ||
// or add a specific IPv4 of 192.168.1.5 : | ||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], | ||
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : | ||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], | ||
|
||
language: "en", | ||
timeFormat: 24, | ||
units: "metric", | ||
|
||
modules: [ | ||
{ | ||
module: "alert", | ||
}, | ||
{ | ||
module: "updatenotification", | ||
position: "top_bar" | ||
}, | ||
{ | ||
module: "clock", | ||
position: "top_left" | ||
}, | ||
{ | ||
module: "calendar", | ||
header: "US Holidays", | ||
position: "top_left", | ||
config: { | ||
calendars: [ | ||
{ | ||
symbol: "calendar-check", | ||
url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
module: "compliments", | ||
position: "lower_third" | ||
}, | ||
{ | ||
module: "currentweather", | ||
position: "top_right", | ||
config: { | ||
location: "New York", | ||
locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | ||
appid: "YOUR_OPENWEATHER_API_KEY" | ||
} | ||
}, | ||
{ | ||
module: "weatherforecast", | ||
position: "top_right", | ||
header: "Weather Forecast", | ||
config: { | ||
location: "New York", | ||
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | ||
appid: "YOUR_OPENWEATHER_API_KEY" | ||
} | ||
}, | ||
{ | ||
module: "newsfeed", | ||
position: "bottom_bar", | ||
config: { | ||
feeds: [ | ||
{ | ||
title: "New York Times", | ||
url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml" | ||
} | ||
], | ||
showSourceTitle: true, | ||
showPublishDate: true, | ||
broadcastNewsFeeds: true, | ||
broadcastNewsUpdates: true | ||
} | ||
}, | ||
] | ||
|
||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") { module.exports = config; } |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/modules)" ]; then | ||
cp -R /opt/magic_mirror/default_modules/. /opt/magic_mirror/modules | ||
fi | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/config)" ]; then | ||
cp /opt/magic_mirror/mm-docker-config.js /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
if [ -f "/opt/magic_mirror/config/config.js.template" ]; then | ||
envsubst < /opt/magic_mirror/config/config.js.template > /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* Magic Mirror Config Sample | ||
* | ||
* By Michael Teeuw http://michaelteeuw.nl | ||
* MIT Licensed. | ||
* | ||
* For more information how you can configurate this file | ||
* See https://github.com/MichMich/MagicMirror#configuration | ||
* | ||
*/ | ||
|
||
var config = { | ||
address: "0.0.0.0", // Address to listen on, can be: | ||
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface | ||
// - another specific IPv4/6 to listen on a specific interface | ||
// - "0.0.0.0" to listen on any interface | ||
// Default, when address config is left out, is "localhost" | ||
port: 8080, | ||
ipWhitelist: [], // Set [] to allow all IP addresses | ||
// or add a specific IPv4 of 192.168.1.5 : | ||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], | ||
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : | ||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], | ||
|
||
language: "en", | ||
timeFormat: 24, | ||
units: "metric", | ||
|
||
modules: [ | ||
{ | ||
module: "alert", | ||
}, | ||
{ | ||
module: "updatenotification", | ||
position: "top_bar" | ||
}, | ||
{ | ||
module: "clock", | ||
position: "top_left" | ||
}, | ||
{ | ||
module: "calendar", | ||
header: "US Holidays", | ||
position: "top_left", | ||
config: { | ||
calendars: [ | ||
{ | ||
symbol: "calendar-check", | ||
url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
module: "compliments", | ||
position: "lower_third" | ||
}, | ||
{ | ||
module: "currentweather", | ||
position: "top_right", | ||
config: { | ||
location: "New York", | ||
locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | ||
appid: "YOUR_OPENWEATHER_API_KEY" | ||
} | ||
}, | ||
{ | ||
module: "weatherforecast", | ||
position: "top_right", | ||
header: "Weather Forecast", | ||
config: { | ||
location: "New York", | ||
locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city | ||
appid: "YOUR_OPENWEATHER_API_KEY" | ||
} | ||
}, | ||
{ | ||
module: "newsfeed", | ||
position: "bottom_bar", | ||
config: { | ||
feeds: [ | ||
{ | ||
title: "New York Times", | ||
url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml" | ||
} | ||
], | ||
showSourceTitle: true, | ||
showPublishDate: true, | ||
broadcastNewsFeeds: true, | ||
broadcastNewsUpdates: true | ||
} | ||
}, | ||
] | ||
|
||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") { module.exports = config; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
FROM node:14-alpine AS BUILD_IMAGE | ||
|
||
ARG branch=master | ||
|
||
ENV NODE_ENV production | ||
WORKDIR /opt/magic_mirror | ||
|
||
# get magic mirror | ||
RUN apk update && apk add --no-cache git \ | ||
&& git clone --depth 1 -c advice.detachedHead=false -b ${branch} https://github.com/MichMich/MagicMirror.git . | ||
|
||
# save default modules and configuration and install dependencies | ||
RUN set -o pipefail \ | ||
&& mkdir dist \ | ||
&& cp -R config /opt/magic_mirror/dist/default_config \ | ||
&& cp -R modules /opt/magic_mirror/dist/default_modules \ | ||
&& npm set unsafe-perm true \ | ||
&& npm ci \ | ||
# removes required depdencies and should not be used | ||
# && npm prune --production --json \ | ||
# prune unnecessary files from ./node_modules, such as markdown, typescript source files, and so on. https://github.com/tj/node-prune | ||
&& wget -q https://install.goreleaser.com/github.com/tj/node-prune.sh | sh \ | ||
# it is intentional that modules are not copied to dist folder. Please keep alphabetically sorted | ||
&& cp -R \ | ||
.git \ | ||
config \ | ||
css \ | ||
fonts \ | ||
index.html \ | ||
js \ | ||
node_modules \ | ||
package.json \ | ||
package-lock.json \ | ||
serveronly \ | ||
translations \ | ||
vendor /opt/magic_mirror/dist | ||
|
||
|
||
FROM node:12-alpine | ||
|
||
WORKDIR /opt/magic_mirror | ||
|
||
RUN set -x \ | ||
&& apk update && apk add --no-cache git \ | ||
&& apk add --no-cache --update libintl \ | ||
&& apk add --no-cache --virtual build_deps gettext \ | ||
&& cp /usr/bin/envsubst /usr/local/bin/envsubst \ | ||
&& apk del build_deps \ | ||
&& mv /usr/local/bin/envsubst /usr/bin/envsubst | ||
|
||
COPY --from=BUILD_IMAGE /opt/magic_mirror/dist/ . | ||
|
||
EXPOSE 8080 | ||
|
||
COPY mm-docker-config.js docker-entrypoint.sh ./ | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
CMD ["node", "serveronly"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/modules)" ]; then | ||
cp -R /opt/magic_mirror/default_modules/. /opt/magic_mirror/modules | ||
fi | ||
|
||
if [ ! "$(ls -A /opt/magic_mirror/config)" ]; then | ||
cp /opt/magic_mirror/mm-docker-config.js /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
if [ -f "/opt/magic_mirror/config/config.js.template" ]; then | ||
envsubst < /opt/magic_mirror/config/config.js.template > /opt/magic_mirror/config/config.js | ||
fi | ||
|
||
exec "$@" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the .git directly, should it also be ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comment #46 (comment)