From 067866af991245d017c91bfb20e7b563b1153bcb Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 9 Jul 2018 12:13:52 -0400 Subject: [PATCH] Break up the build process in 2. This will produce an extra layer but will improve on build time because we'll be updating Embark more frequently than the surrounding tools (geth and IPFS.) Also, doing this negates the need to `sudo - embark` a bunch of commands we previously had to. Additionally, create and use a workdir. --- Dockerfile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08db0ae..bf1868a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:8.11.3-stretch MAINTAINER Andre Medeiros -ENV EMBARK_VERSION=3.1.4 \ +ENV EMBARK_VERSION=3.1.5 \ GANACHE_VERSION=6.1.4 \ GETH_VERSION=1.8.11-dea1ce05 \ IPFS_VERSION=0.4.15 @@ -34,9 +34,13 @@ RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \ && tar -xvzf "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \ && cp go-ipfs/ipfs /usr/local/bin/ipfs \ && rm -rf go-ipfs "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \ - # Setup ~embark - && su - embark -c "mkdir /home/embark/.npm-packages" \ - && su - embark -c "echo prefix=/home/embark/.npm-packages > /home/embark/.npmrc" \ + && mkdir /dapp \ + && chown embark:embark /dapp + +USER embark + +RUN mkdir /home/embark/.npm-packages \ + && echo prefix=/home/embark/.npm-packages > /home/embark/.npmrc \ && for directive in \ "export NPM_PACKAGES=\$HOME/.npm-packages" \ "export NODE_PATH=\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH" \ @@ -45,12 +49,16 @@ RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \ echo ${directive} >> /home/embark/.profile \ && echo ${directive} >> /home/embark/.bashrc; \ done \ + # Ensure we source the updated bashrc + && . ~/.bashrc \ # Install embark and the simulator - && su - embark -c "npm install -g embark@${EMBARK_VERSION} ganache-cli@${GANACHE_VERSION}" \ + && npm install -g "embark@${EMBARK_VERSION}" "ganache-cli@${GANACHE_VERSION}" \ + # Initialize IPFS + && ipfs init \ # Cleanup build stuff && echo "Done" -USER embark +WORKDIR /dapp CMD ["embark"]