Skip to content

Commit 787d13a

Browse files
committed
Fix webpack build
1 parent 2870f69 commit 787d13a

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

Dockerfile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM node:10
1+
FROM skydive/skydive
2+
23
WORKDIR /usr/src/skydive-ui
4+
5+
RUN apt-get -y update \
6+
&& apt-get -y install nodejs npm
7+
38
COPY package.json /usr/src/skydive-ui
9+
COPY package-lock.json /usr/src/skydive-ui
10+
COPY tsconfig.json /usr/src/skydive-ui
11+
COPY webpack.config.js /usr/src/skydive-ui
12+
COPY assets /usr/src/skydive-ui/assets
13+
COPY src /usr/src/skydive-ui/src
14+
COPY entry.sh /usr/src/skydive-ui
15+
416
RUN npm install
5-
COPY . .
6-
CMD [ "/usr/src/skydive-ui/node_modules/webpack-dev-server/bin/webpack-dev-server.js", "--host", "0.0.0.0" ]
17+
RUN npm run build
18+
19+
ENTRYPOINT /usr/src/skydive-ui/entry.sh

entry.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
if [ -f /dump.json ]; then
4+
/usr/bin/skydive --conf /etc/skydive.yml analyzer &
5+
sleep 15
6+
7+
/usr/bin/skydive client topology import --file /dump.json
8+
fi
9+
10+
python3 -m http.server 8080 --directory dist/

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "topsky",
2+
"name": "skydive-ui",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
@@ -69,8 +69,8 @@
6969
"webpack-dev-server": "^3.11.0"
7070
},
7171
"scripts": {
72-
"start": "webpack serve --mode development --disable-host-check --host 0.0.0.0 --open-page=$PAGE",
73-
"build": "webpack --mode production",
72+
"start": "webpack serve --mode development --disable-host-check --host 0.0.0.0",
73+
"build": "webpack",
7474
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha -r ts-node/register tests/**/*.test.ts",
7575
"coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test"
7676
}

webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const HtmlWebPackPlugin = require("html-webpack-plugin");
22
const CopyWebPackPlugin = require('copy-webpack-plugin');
33

4+
var path = require('path');
5+
46
const htmlPlugin = new HtmlWebPackPlugin({
57
template: "./src/index.html",
68
filename: "./index.html"
@@ -55,6 +57,9 @@ module.exports = {
5557

5658
devServer: {
5759
historyApiFallback: true,
60+
contentBase: path.join(__dirname, 'dist'),
61+
compress: true,
62+
port: 8080
5863
},
5964

6065
devtool: "source-map",

0 commit comments

Comments
 (0)