Skip to content

Commit 3a68562

Browse files
committed
Docker deployment examples
1 parent c7ae839 commit 3a68562

File tree

7 files changed

+20
-7
lines changed

7 files changed

+20
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
npm-debug.log
3+
.env
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:10-alpine
2+
3+
WORKDIR /usr/src/app
4+
COPY package*.json ./
5+
RUN npm install
6+
COPY . .
7+
8+
CMD [ "npm", "start" ]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dashboard-app/node_modules
12
node_modules
23
npm-debug.log
34
.env

examples/real-time-dashboard/dashboard-app/src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { CubeProvider } from "@cubejs-client/react";
66
import Header from "./components/Header";
77
import WebSocketTransport from "@cubejs-client/ws-transport";
88
import tracker from "./tracker";
9-
const CUBEJS_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzI1ODQzNjd9.8Po-ZchZlEJEtqwq5hU0aHDnsJrlkpKs1P2Cs5dbfBQ";
9+
const CUBEJS_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzM2MjI5MjR9.iD_sSpXRBQSO0ywh5zSPHpHV-1O37oQMakrkG03kR-o";
1010
let WS_URL;
1111
if (process.env.NODE_ENV === 'production') {
12-
WS_URL = "wss://cubejs-real-time-demo.herokuapp.com/"
12+
WS_URL = "wss://real-time-dashboard-demo.cube.dev/"
1313
} else {
1414
WS_URL = "ws://localhost:4000/"
1515
}

examples/real-time-dashboard/dashboard-app/src/tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fetch } from "whatwg-fetch";
44

55
let URL;
66
if (process.env.NODE_ENV === 'production') {
7-
URL = "https://cubejs-real-time-demo.herokuapp.com"
7+
URL = "https://real-time-dashboard-demo.cube.dev"
88
} else {
99
URL = "http://localhost:4000"
1010
}

examples/real-time-dashboard/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ const cubejsServer = CubejsServerCore.create({
2222
}
2323
});
2424

25+
if (process.env.NODE_ENV === 'production') {
26+
app.use(serveStatic(path.join(__dirname, 'dashboard-app/build')));
27+
}
28+
2529
cubejsServer.initApp(app);
2630
const server = http.createServer({}, app);
2731

@@ -42,10 +46,6 @@ app.post('/collect', (req, res) => {
4246
});
4347
});
4448

45-
if (process.env.NODE_ENV === 'production') {
46-
app.use(serveStatic(path.join(__dirname, 'dashboard-app/build')));
47-
}
48-
4949
const port = process.env.PORT || 4000;
5050
server.listen(port, () => {
5151
console.log(`🚀 Cube.js server is listening on ${port}`);

examples/real-time-dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "./node_modules/.bin/cubejs-dev-server",
7+
"build-front": "cd dashboard-app && yarn build",
78
"start": "node index.js"
89
},
910
"dependencies": {

0 commit comments

Comments
 (0)