Skip to content

Commit 6c83f28

Browse files
authored
feat: Create usable Dockerfile (#278)
Improve the Dockerfile Create docker-compose file to launch IPFS with the Node with one command Add documentation for Docker Some fix: Increase timeout threshold for Web3 connection to Rinkeby to 30s Replace a dead link inside Request Node documentation
1 parent da7afc7 commit 6c83f28

File tree

4 files changed

+72
-16
lines changed

4 files changed

+72
-16
lines changed

packages/ethereum-storage/src/lib/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const config: any = {
1717
url: 'http://localhost:8545',
1818
},
1919
rinkeby: {
20-
timeout: 10000,
20+
timeout: 30000,
2121
url:
2222
'https://rinkeby.infura.io/v3/336bb135413f4f5f92138d4539ae4300' /* eslint-disable-line spellcheck/spell-checker */,
2323
},

packages/request-node/Dockerfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
FROM node:latest as builder
2-
WORKDIR /
1+
# Install necessary modules for the nodes
2+
FROM node:10.14.2 as installer
3+
4+
WORKDIR /app
35
ADD package.json .
46
RUN npm install
57

6-
# ADD src src
7-
# ADD tsconfig.json tsconfig.json
8-
# RUN npm install typescript
9-
# RUN npm run build
10-
11-
12-
FROM alpine:latest as main
8+
# Build request-node
9+
ADD src src
10+
RUN npm install -g typescript
11+
ADD docker/docker-tsconfig.json tsconfig.json
12+
RUN tsc -b
1313

14-
RUN apk add --update nodejs
14+
# Launch the server
15+
FROM node:10.14.2-alpine
1516

1617
WORKDIR /request-node
17-
COPY --from=builder /node_modules node_modules
18+
COPY --from=installer /app/node_modules node_modules
19+
COPY --from=installer /app/dist dist
1820
ADD package.json .
19-
# WORKDIR /dist
20-
ADD dist dist
2121

2222
# Port configuration
2323
ENV PORT 3000

packages/request-node/README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ request-node start
117117
The Request Node source must be downloaded from Github and executed with Node.js.
118118

119119
```bash
120-
git clone https://github.com/RequestNetwork/requestNetwork/tree/master/packages/request-node/request-node.git
121-
cd request-node
120+
git clone https://github.com/RequestNetwork/requestNetwork.git
121+
cd packages/request-node
122122
npm install
123123
npm run build
124124
```
@@ -187,6 +187,41 @@ candy maple cake sugar pudding cream honey rich smooth crumble sweet treat
187187

188188
This mnemonic should only be used for testing.
189189

190+
### Docker
191+
192+
The Request Node can be deployed with Docker.
193+
For now, the user has to clone the repository to build the Docker and run it.
194+
195+
```bash
196+
git clone https://github.com/RequestNetwork/requestNetwork.git
197+
cd packages/request-node
198+
docker build -t "request-node" .
199+
docker run request-node
200+
```
201+
202+
The environment variables used to configure the Node can be defined in the `docker run` command.
203+
204+
For example, the user can define custom parameters for IPFS connection with the following command:
205+
206+
```
207+
docker run -e IPFS_HOST=<custom_ipfs_host> IPFS_PORT=<custom_ipfs_port>
208+
```
209+
210+
If the user want the server to listen on a specific port, he has to expose that port as well:
211+
212+
```
213+
docker run -e PORT=80 --expose 80
214+
```
215+
216+
The user can use the docker-compose tool to run an environment containing the Request Node and an instance of IPFS with the following command:
217+
218+
```bash
219+
docker-compose up
220+
```
221+
222+
The environment variables must be defined in the `docker-compose.yml` file in the `environment` section. `$ETHEREUM_NETWORK_ID` and `$WEB3_PROVIDER_URL` must be defined.
223+
224+
190225
## Contributing
191226

192227
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "3.0"
2+
3+
services:
4+
request-node:
5+
image: request-node
6+
ports:
7+
- "3000:3000"
8+
links:
9+
- ipfs
10+
environment:
11+
- IPFS_HOST=ipfs
12+
13+
ipfs:
14+
image: ipfs/go-ipfs
15+
volumes:
16+
- ipfs_staging:/export
17+
- ipfs_data:/data/ipfs
18+
19+
volumes:
20+
ipfs_staging:
21+
ipfs_data:

0 commit comments

Comments
 (0)