FROM node:8.9-slim as builder ARG STANDALONE RUN apt-get update && apt-get install -y --no-install-recommends git \ $([ -n "$STANDALONE" ] || echo "autoconf automake build-essential libtool libgmp-dev \ libsqlite3-dev python python3 wget zlib1g-dev") ARG TESTRUNNER ARG LIGHTNINGD_VERSION=v0.6.2 RUN [ -n "$STANDALONE" ] || \ (git clone https://github.com/ElementsProject/lightning.git /opt/lightningd \ && cd /opt/lightningd \ && git checkout $LIGHTNINGD_VERSION \ && DEVELOPER=$TESTRUNNER ./configure \ && make) ENV BITCOIN_VERSION 0.17.0.1 ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz ENV BITCOIN_SHA256 6ccc675ee91522eee5785457e922d8a155e4eb7d5524bd130eb0ef0f0c4a6008 ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS.asc ENV BITCOIN_PGP_KEY 01EA5486DE18A882D4C2684590C8019E36C2E964 RUN [ -n "$STANDALONE" ] || \ (mkdir /opt/bitcoin && cd /opt/bitcoin \ && wget -qO bitcoin.tar.gz "$BITCOIN_URL" \ && echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - \ && gpg --keyserver keyserver.ubuntu.com --recv-keys "$BITCOIN_PGP_KEY" \ && wget -qO bitcoin.asc "$BITCOIN_ASC_URL" \ && gpg --verify bitcoin.asc \ && BD=bitcoin-0.17.0/bin \ # the above is needed because the dir name is missing the .1 && BD=bitcoin-$BITCOIN_VERSION/bin \ && tar -xzvf bitcoin.tar.gz $BD/bitcoind $BD/bitcoin-cli --strip-components=1) RUN mkdir /opt/bin && ([ -n "$STANDALONE" ] || \ (mv /opt/lightningd/cli/lightning-cli /opt/bin/ \ && mv /opt/lightningd/lightningd/lightning* /opt/bin/ \ && mv /opt/bitcoin/bin/* /opt/bin/)) WORKDIR /opt/charged COPY package.json npm-shrinkwrap.json ./ RUN npm install \ && test -n "$TESTRUNNER" || { \ cp -r node_modules node_modules.dev \ && npm prune --production \ && mv -f node_modules node_modules.prod \ && mv -f node_modules.dev node_modules; } COPY . . RUN npm run dist \ && rm -rf src \ && test -n "$TESTRUNNER" || (rm -rf test node_modules && mv -f node_modules.prod node_modules) FROM node:8.9-slim WORKDIR /opt/charged ARG TESTRUNNER ENV HOME /tmp ENV NODE_ENV production ARG STANDALONE ENV STANDALONE=$STANDALONE RUN ([ -n "$STANDALONE" ] || ( \ apt-get update && apt-get install -y --no-install-recommends inotify-tools libgmp-dev libsqlite3-dev \ $(test -n "$TESTRUNNER" && echo jq))) \ && rm -rf /var/lib/apt/lists/* \ && ln -s /opt/charged/bin/charged /usr/bin/charged \ && mkdir /data \ && ln -s /data/lightning /tmp/.lightning COPY --from=builder /opt/bin /usr/bin COPY --from=builder /opt/charged /opt/charged CMD [ "bin/docker-entrypoint.sh" ] EXPOSE 9112 9735