Skip to content

Commit b0bb113

Browse files
kotanernielsdejong
andauthored
feat(docker): add Dockerfile, wrapper script to build & run (#63)
* feat(docker): add Dockerfile, wrapper script to build & run * Added some small extension to the docker section in the README Co-authored-by: Niels de Jong <[email protected]>
1 parent f746e29 commit b0bb113

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ To build the app for production:
3333
- execute `npm run build`. This will create a `build` folder in your project directory.
3434
- deploy the contents of the build folder to a web server. You should then be able to run the web app.
3535

36+
### Build and run Docker image
37+
Make sure you have a recent version of `docker` installed.
38+
Use the script under `./tools/neodash-build-run.bash` to build the multi-stage NeoDash image & access it with nginx:
39+
```
40+
$ cd tools/
41+
$ ./neodash-build-run.bash
42+
```
43+
Then go to http://localhost:8080/ in your browser.
3644

3745
## Extending NeoDash
3846
As of v2.0, NeoDash is easy to extend with your own visualizations. There are two steps to take to plug in your own charts:

tools/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM centos:centos8.3.2011 AS builder
2+
3+
RUN yum install -y epel-release; yum check-update; pwd
4+
RUN yum install -y rsync git
5+
6+
RUN dnf module list nodejs && dnf module enable -y nodejs:12
7+
RUN dnf install -y nodejs
8+
9+
RUN git clone -b 2.0.5 https://github.com/nielsdejong/neodash.git /usr/local/src/neodash
10+
RUN npm install -g typescript
11+
RUN npm install -g jest
12+
13+
RUN git clone https://github.com/nielsdejong/charts.git /usr/local/src/charts && cd /usr/local/src/charts && git checkout cd8bf3707d48f2c34ec6a1ad126cfd28b5ac3065
14+
RUN cd /usr/local/src/charts; npm install; npm run build
15+
WORKDIR /usr/local/src/neodash
16+
RUN rm -rf node_modules/ && npm install
17+
RUN cd /usr/local/src/neodash/node_modules/@graphapps/charts; rsync -avP /usr/local/src/charts/* .
18+
RUN npm run build
19+
20+
21+
FROM nginx:mainline AS neodash
22+
LABEL org.opencontainers.image.authors="[email protected]"
23+
WORKDIR /usr/share/nginx/html
24+
COPY --from=builder /usr/local/src/neodash/build /usr/share/nginx/html

tools/neodash-build-run.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
docker build . -t neodash
3+
docker run -it --rm -p 8080:80 neodash

0 commit comments

Comments
 (0)