This repository has been archived by the owner on Apr 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from dappnode/v0.2.1
v0.2.1
- Loading branch information
Showing
22 changed files
with
4,297 additions
and
1,560 deletions.
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
testbuild | ||
test_build | ||
node_modules | ||
build_* | ||
build_* | ||
|
||
# Build artifacts | ||
build/src/dist | ||
build/src/build | ||
build/src/bundle.js |
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,2 @@ | ||
**/node_modules | ||
node_modules/ |
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 |
---|---|---|
@@ -1,54 +1,33 @@ | ||
FROM node:10.15.3-alpine as build | ||
|
||
###### NOTES - TODO REMOVE | ||
# - 92.3 MB - Original | ||
# - 71.8 MB - Using `apk add nodejs` instead of building it | ||
# - 57.6 MB - Removing unwanted depedencies + web3js | ||
# - 33.7 MB - Bundling the code with webpack | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
RUN apk update && \ | ||
apk add git python make g++ curl && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
COPY src . | ||
COPY src/package.json . | ||
COPY src/package-lock.json . | ||
RUN npm install --production | ||
|
||
RUN npm install --production --unsafe-perm | ||
RUN npm install -D webpack webpack-cli | ||
COPY src . | ||
RUN npm run bundle | ||
|
||
# This results in a single layer image | ||
FROM alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN apk add --no-cache libstdc++ && \ | ||
ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \ | ||
ALPINE_GLIBC_PACKAGE_VERSION="2.28-r0" && \ | ||
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ | ||
ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ | ||
ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ | ||
apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \ | ||
wget \ | ||
"https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" \ | ||
-O "/etc/apk/keys/sgerrand.rsa.pub" && \ | ||
wget \ | ||
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ | ||
apk add --no-cache \ | ||
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ | ||
\ | ||
rm "/etc/apk/keys/sgerrand.rsa.pub" && \ | ||
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \ | ||
echo "export LANG=$LANG" > /etc/profile.d/locale.sh && \ | ||
\ | ||
apk del glibc-i18n && \ | ||
\ | ||
rm "/root/.wget-hsts" && \ | ||
apk del .build-dependencies && \ | ||
rm \ | ||
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ | ||
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" | ||
|
||
COPY --from=build /usr/local/bin/node /usr/local/bin/node | ||
COPY --from=build /usr/src/app /usr/src/app | ||
|
||
ENTRYPOINT node /usr/src/app/src/index.js | ||
RUN apk add --update nodejs | ||
|
||
COPY --from=build /usr/src/app/bundle.js /usr/src/app | ||
|
||
ENTRYPOINT node /usr/src/app/bundle.js |
Oops, something went wrong.