Skip to content

Commit

Permalink
Docker to build the web wallet and serve it. (bitshares#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
aza authored and svk31 committed Jan 23, 2018
1 parent 550d499 commit 2b817d2
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:6

# Install nginx
RUN apt-get update \
&& apt-get install -y nginx --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN npm install -g cross-env

# We copy the code from the docker-compose-yml
# RUN git clone https://github.com/bitshares/bitshares-ui.git /bitshares-ui
CMD mkdir /bitshares-ui
WORKDIR /bitshares-ui

ADD package.json .
RUN cross-env npm install --env.prod

EXPOSE 80

## Copying default configuration
ADD conf/nginx.conf /etc/nginx/nginx.conf
ADD conf/start.sh /start.sh
RUN chmod a+x /start.sh

## Entry point
ENTRYPOINT ["/start.sh"]
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ __Mac__
This will compile the UI with some special modifications for use with Electron, generate installable binaries with Electron and copy the result to the root `build/binaries` folder.


### Docker

Clone this repository, run `docker-compose up` and visit localhost:8080


## Contributing
Please work off the staging branch and make pull requests to that branch. The master branch will only be updated for new releases.
Expand Down Expand Up @@ -115,4 +119,3 @@ Our style guideline is based on 'Airbnb JavaScript Style Guide' (https://github.
- Spaces inside curly braces are optional

We strongly encourage to use _eslint_ to make sure the code adhere to our style guidelines.

58 changes: 58 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

worker_processes 4;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 165;

gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;

server {
listen 80;
server_name _;
root /var/www/;

ssl off;
# @TODO configure ssl

location ~ ^/(img|images|photo|photos|page|pages|uploads|countries|make|pic|foto|list|pictures|news|feed|rotated|carimg|category|reviews) {
access_log off;
return 404;
}

# This makes the faucet work
location ~ ^/[\w\d\.-]+\.(js|css|dat|png|json|ico)$ {
try_files $uri $uri/wallet =404;
}

location / {
index index.html index.htm;
try_files $uri /index.html;
}
}
}
8 changes: 8 additions & 0 deletions conf/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# We build the wallet each time we run the docker and it takes a couple of minutes
npm run build

cp -r /bitshares-ui/build/dist/* /var/www/

nginx -g "daemon off;"
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "2"
volumes:
wallet_build: {}

services:
web-wallet:
build: .
ports:
- "8080:80"
volumes:
- wallet_build:/bitshares-ui/build/dist
- .:/bitshares-ui

0 comments on commit 2b817d2

Please sign in to comment.