Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the app so that it works with Docker #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y nodejs npm
RUN apt-get install -y curl && npm cache clean -f && npm install -g n && n stable
RUN apt-get install -y net-tools

WORKDIR /explorer
COPY . .

EXPOSE 8000
CMD ["npm","start"]
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

![EthExplorer Screenshot](http://i.imgur.com/NHFYq0x.png)

##License
## License

GPL (see LICENSE)

##Installation
## Installation

Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git "Git installation") if you haven't already

Expand All @@ -26,4 +26,12 @@ Then visit http://localhost:8000 in your browser of choice. You might get an err

Install [geth](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum "Geth install") if you don't already have it, then run the above command.

Then refresh the page in your browser
Then refresh the page in your browser

## Docker

If you are using Docker, you can use this [Docker image from DockerHub](https://hub.docker.com/r/zulhfreelancer/ethereum_explorer/). See [Dockerfile](Dockerfile).

```
$ docker run --name block_explorer --rm -it -p 8000:8000 zulhfreelancer/ethereum_explorer:latest
```
9 changes: 5 additions & 4 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ angular.module('ethExplorer', ['ngRoute','ui.bootstrap'])
}])
.run(function($rootScope) {
var web3 = new Web3();
var eth_node_url = 'http://localhost:8545'; // TODO: remote URL
var host = window.location.hostname;
var eth_node_url = 'http://' + host + ':8545';
web3.setProvider(new web3.providers.HttpProvider(eth_node_url));
$rootScope.web3 = web3;
function sleepFor( sleepDuration ){
var now = new Date().getTime();
while(new Date().getTime() < now + sleepDuration){ /* do nothing */ }
while(new Date().getTime() < now + sleepDuration){ /* do nothing */ }
}
var connected = false;
if(!web3.isConnected()) {
$('#connectwarning').modal({keyboard:false,backdrop:'static'})
$('#connectwarning').modal('show')
$('#connectwarning').modal({keyboard:false,backdrop:'static'})
$('#connectwarning').modal('show')
}
});
Loading