File tree Expand file tree Collapse file tree 8 files changed +490
-4
lines changed
Expand file tree Collapse file tree 8 files changed +490
-4
lines changed Original file line number Diff line number Diff line change 1+ node_modules /
2+ docs /
Original file line number Diff line number Diff line change @@ -220,5 +220,17 @@ app.use(router.allowedMethods());
220220app .listen (3001 );
221221```
222222
223+ ## Build Docker Image
224+
225+ ```
226+ $ npm install
227+ $ npm run build:release
228+ ```
229+
230+ ```
231+ $ docker build . -f docker-image/Dockerfile -t apisguru/graphql-voyager
232+ $ docker push apisguru/graphql-voyager
233+ ```
234+
223235## Credits
224236This tool is inspired by [ graphql-visualizer] ( https://github.com/NathanRSmith/graphql-visualizer ) project.
Original file line number Diff line number Diff line change 1+ FROM node:11.14.0-alpine
2+
3+ RUN apk add \
4+ ca-certificates \
5+ musl-dev
6+
7+ ADD dist/ /graphql-voyager/dist/
8+ ADD middleware/ /graphql-voyager/middleware/
9+ ADD src/ /graphql-voyager/src/
10+ ADD package.json /graphql-voyager/package.json
11+ ADD docker-image/package.json /graphql-voyager/docker-image/package.json
12+ ADD docker-image/package-lock.json /graphql-voyager/docker-image/package-lock.json
13+
14+ RUN npm install
15+
16+ ADD docker-image/index.js /graphql-voyager/docker-image/index.js
17+
18+ WORKDIR /graphql-voyager/
19+
20+ WORKDIR /graphql-voyager/docker-image/
21+
22+ RUN npm install
23+
24+ ENV PORT=3001
25+
26+ CMD node index.js
Original file line number Diff line number Diff line change 1+ const express = require ( 'express' ) ;
2+ const voyager = require ( 'graphql-voyager/middleware' ) ;
3+
4+ const app = express ( ) ;
5+
6+ app . use ( '/' , voyager . express ( { endpointUrl : process . env . GRAPHQL_ENDPOINT } ) ) ;
7+
8+ process . on ( 'SIGINT' , function ( ) {
9+ console . log ( "\nGracefully shutting down from SIGINT (Ctrl-C)" ) ;
10+ process . exit ( 1 ) ;
11+ } ) ;
12+
13+ const port = process . env . PORT ;
14+
15+ app . listen ( port , function ( err ) {
16+ if ( err ) {
17+ throw new Error (
18+ `Failed to start listening on ${ port } , error: ${ err . message } `
19+ ) ;
20+ }
21+ console . log ( `listening on http://0.0.0.0:${ port } ` ) ;
22+ } ) ;
You can’t perform that action at this time.
0 commit comments