Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #24 from dappnode/v0.2.1
Browse files Browse the repository at this point in the history
v0.2.1
  • Loading branch information
eduadiez committed May 22, 2019
2 parents 74c636d + d62cf02 commit 4f47edc
Show file tree
Hide file tree
Showing 22 changed files with 4,297 additions and 1,560 deletions.
7 changes: 6 additions & 1 deletion .gitignore
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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ jobs:
on:
tags: true
condition: "$TRAVIS_TAG = release || $TRAVIS_TAG = release/patch || $TRAVIS_TAG = release/minor || $TRAVIS_TAG = release/major"
# after_deploy:
# - wget https://raw.githubusercontent.com/dappnode/DAppNode/master/scripts/after_deploy.sh
# - source after_deploy.sh
after_deploy:
- wget https://raw.githubusercontent.com/dappnode/DAppNode/master/scripts/after_deploy.sh
- source after_deploy.sh
2 changes: 2 additions & 0 deletions build/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
node_modules/
55 changes: 17 additions & 38 deletions build/Dockerfile
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
Loading

0 comments on commit 4f47edc

Please sign in to comment.