diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8a43dfce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/.git/ +/node_modules/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..8f295dfa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use minideb instead of alpine since some modules use native binary not supported in alpine +FROM bitnami/node:10.9.0 + +WORKDIR /code + +# Install git because we currently fetch codechain core from github +RUN apt-get update && apt-get install git + +# Install yarn +RUN npm install yarn -g + +# Leverage cache based on lockfile +COPY package.json yarn.lock /code/ + +# Install dependencies +RUN yarn + +# Install codechain explorer +COPY . /code +RUN yarn + +# Run server +CMD ["yarn", "run", "start"] diff --git a/README.md b/README.md index 990d79e9..82f919c1 100644 --- a/README.md +++ b/README.md @@ -130,5 +130,5 @@ Build CodeChain-explorer with following script. You can get optimized, uglified | REACT_APP_URL | | | Client) This is used for open graph | | REACT_APP_GOOGLE_ANALYTICS_ID | | | Client) | | CODECHAIN_HOST | http://127.0.0.1:8080 | | Server, Worker) | -| ELASTICSERACH_HOST | http://127.0.0.1:9200 | | Server, Worker) | +| ELASTICSEARCH_HOST | http://127.0.0.1:9200 | | Server, Worker) | | CODECHAIN_CHAIN | solo | solo, husky | Worker) | diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..3b2aab77 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' +services: + codechain-explorer: + build: . + ports: + - "3000:3000" + - "8081:8081" + - "5000:5000" + volumes: + - $PWD:/code + depends_on: + - codechain + - elasticsearch + environment: + - CODECHAIN_HOST=http://codechain:8080 + - ELASTICSEARCH_HOST=http://elasticsearch:9200 + + codechain: + image: kodebox/codechain:7f3d3030d8d4bb86a5b7025f73877df45d8bd97a + ports: + - "8080:8080" + command: + - -csolo + - --jsonrpc-interface=0.0.0.0 + - --db-path=codechaindata:/db + volumes: + - codechaindata:/db + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4 + environment: + - ES_HOSTS=0.0.0.0:9200 + +volumes: + codechaindata: