Skip to content

Commit

Permalink
Fix webpack build
Browse files Browse the repository at this point in the history
  • Loading branch information
safchain committed Dec 30, 2020
1 parent 2870f69 commit 787d13a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
FROM node:10
FROM skydive/skydive

WORKDIR /usr/src/skydive-ui

RUN apt-get -y update \
&& apt-get -y install nodejs npm

COPY package.json /usr/src/skydive-ui
COPY package-lock.json /usr/src/skydive-ui
COPY tsconfig.json /usr/src/skydive-ui
COPY webpack.config.js /usr/src/skydive-ui
COPY assets /usr/src/skydive-ui/assets
COPY src /usr/src/skydive-ui/src
COPY entry.sh /usr/src/skydive-ui

RUN npm install
COPY . .
CMD [ "/usr/src/skydive-ui/node_modules/webpack-dev-server/bin/webpack-dev-server.js", "--host", "0.0.0.0" ]
RUN npm run build

ENTRYPOINT /usr/src/skydive-ui/entry.sh
10 changes: 10 additions & 0 deletions entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [ -f /dump.json ]; then
/usr/bin/skydive --conf /etc/skydive.yml analyzer &
sleep 15

/usr/bin/skydive client topology import --file /dump.json
fi

python3 -m http.server 8080 --directory dist/
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "topsky",
"name": "skydive-ui",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand Down Expand Up @@ -69,8 +69,8 @@
"webpack-dev-server": "^3.11.0"
},
"scripts": {
"start": "webpack serve --mode development --disable-host-check --host 0.0.0.0 --open-page=$PAGE",
"build": "webpack --mode production",
"start": "webpack serve --mode development --disable-host-check --host 0.0.0.0",
"build": "webpack",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha -r ts-node/register tests/**/*.test.ts",
"coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test"
}
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyWebPackPlugin = require('copy-webpack-plugin');

var path = require('path');

const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
Expand Down Expand Up @@ -55,6 +57,9 @@ module.exports = {

devServer: {
historyApiFallback: true,
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 8080
},

devtool: "source-map",
Expand Down

0 comments on commit 787d13a

Please sign in to comment.