From 64bde8dcbe6b3baffe1466e77e3a06171070b33f Mon Sep 17 00:00:00 2001 From: georgemjohnson11 Date: Thu, 7 Apr 2022 09:26:05 -0600 Subject: [PATCH 1/2] Containerize constellation using Docker --- .dockerignore | 1 + Dockerfile | 11 +++++++++++ README.md | 10 +++++++++- webpack.config.js | 11 ++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d0e2c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:17.8.0 +ENV NODE_ENV=production +ENV NODE_OPTIONS=--openssl-legacy-provider +RUN npm install webpack-cli webpack -g + +WORKDIR / + +COPY ["webpack.config.js", "package.json", "package-lock.json*", "./"] +RUN npm update && npm install +COPY . . +CMD [ "npm", "run", "start" ] \ No newline at end of file diff --git a/README.md b/README.md index 66fd269..5544b9c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,15 @@ ### Local UI ```shell git clone git@github.com:hicsail/constellation-js.git -npm run build && npm run start +npm install && npm run build && npm run start +``` +Then open `http://localhost:8082/` on browser + +### Docker UI +```shell +git clone git@github.com:hicsail/constellation-js.git +docker build . -t constellation +docker run -d -p 8082:8082 constellation:latest ``` Then open `http://localhost:8082/` on browser diff --git a/webpack.config.js b/webpack.config.js index 559543d..49020e8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,15 +1,20 @@ var path = require('path'); module.exports = { + devServer: { + host: '0.0.0.0', + allowedHosts: 'all' + }, entry: './lib/constellation.js', output: { path: path.resolve(__dirname, 'demos/static/js'), filename: 'constellation.js', library: 'constellation', }, - node: { - fs: 'empty', - child_process: 'empty', + resolve: { + fallback: { + fs: false + } }, module: { rules: [ From 7b76cf908bcf3c325918fd80fca33c77bc65d25b Mon Sep 17 00:00:00 2001 From: georgemjohnson11 Date: Thu, 7 Apr 2022 09:59:29 -0600 Subject: [PATCH 2/2] Add newline at end of file for new files --- .dockerignore | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 40b878d..c2658d7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -node_modules/ \ No newline at end of file +node_modules/ diff --git a/Dockerfile b/Dockerfile index 3d0e2c9..20d31e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ WORKDIR / COPY ["webpack.config.js", "package.json", "package-lock.json*", "./"] RUN npm update && npm install COPY . . -CMD [ "npm", "run", "start" ] \ No newline at end of file +CMD [ "npm", "run", "start" ]