From 90da464373c34a42c3c23bea3e9871ee30c9c3fb Mon Sep 17 00:00:00 2001 From: Maksym Zavershynskyi Date: Thu, 13 Jun 2019 11:11:04 -0700 Subject: [PATCH] Add docker container --- .dockerignore | 3 +++ Dockerfile | 34 ++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ scripts/init_nginx.sh | 4 ++++ scripts/wallet.nginx | 3 +++ 5 files changed, 50 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 scripts/init_nginx.sh create mode 100644 scripts/wallet.nginx diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..510816b4d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +**/.git +**/node_modules +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..11c37e8389 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# syntax=docker/dockerfile-upstream:experimental + +FROM phusion/baseimage:0.11 + +ENTRYPOINT ["/sbin/my_init", "--"] + +RUN curl -o /tmp/node_setup.sh "https://deb.nodesource.com/setup_11.x" +RUN bash /tmp/node_setup.sh +RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +RUN echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list +RUN apt-get update -qq && apt-get install -y \ + jq \ + nodejs \ + nginx \ + # wallet + ruby-full \ + build-essential \ + zlib1g-dev \ + git \ + rsync + +# near-wallet +RUN mkdir /near-wallet +COPY . /near-wallet/ +WORKDIR /near-wallet +RUN npm install +RUN npm run build +RUN mkdir -p /var/www/html/wallet +RUN rsync -ar /near-wallet/build /var/www/html/wallet + +# nginx +RUN rm /etc/nginx/sites-enabled/default +COPY /scripts/wallet.nginx /etc/nginx/sites-enabled/wallet +COPY /scripts/init_nginx.sh /etc/my_init.d/ diff --git a/README.md b/README.md index bbc7442b1b..eea845831b 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,9 @@ This is in-browser web-based wallet for working with NEAR DevNet accounts. This DISCLAIMER: This is a developers' preview Wallet. It should be used for NEAR Protocol DevNet only. Learn more at https://wallet.nearprotocol.com + +Dockerized Wallet +=== + +Dockerized wallet operates as a micro-service. It uses nginx to serve the local static content. As the result, Wallet is +not parametrizable with environment variables. diff --git a/scripts/init_nginx.sh b/scripts/init_nginx.sh new file mode 100755 index 0000000000..6a1a8080f1 --- /dev/null +++ b/scripts/init_nginx.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +/etc/init.d/nginx start diff --git a/scripts/wallet.nginx b/scripts/wallet.nginx new file mode 100644 index 0000000000..37afdf8757 --- /dev/null +++ b/scripts/wallet.nginx @@ -0,0 +1,3 @@ +server { + root /var/www/html/wallet; +}