Skip to content

Commit a87c2a3

Browse files
committed
base
1 parent 2c66119 commit a87c2a3

File tree

8 files changed

+452
-0
lines changed

8 files changed

+452
-0
lines changed

0-base/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:10
2+
3+
WORKDIR /app
4+
5+
ADD . .
6+
7+
RUN yarn install
8+
9+
ENTRYPOINT [ "node", "/app/index.js" ]

0-base/Tiltfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- mode: Python -*
2+
3+
k8s_yaml('kubernetes.yaml')
4+
k8s_resource('example-nodejs', port_forwards=8000,
5+
resource_deps=['deploy']
6+
)
7+
8+
# Records the current time, then kicks off a server update.
9+
# Normally, you would let Tilt do deploys automatically, but this
10+
# shows you how to set up a custom workflow that measures it.
11+
local_resource(
12+
'deploy',
13+
'date +%s%N > start-time.txt',
14+
)
15+
16+
docker_build('example-nodejs-image', '.')
17+

0-base/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!doctype html>
2+
<html>
3+
<body style="font-size: 30px; font-family: sans-serif; margin: 0;">
4+
<div style="display: flex; flex-direction: column; width: 100vw; height: 100vh; align-items: center; justify-content: center;">
5+
<img src="pets.png" style="max-width: 30vw; max-height: 30vh;">
6+
<div>Hello cats!</div>
7+
</div>
8+
</body>
9+
</html>

0-base/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const express = require('express');
2+
const app = express();
3+
const path = require('path');
4+
5+
app.use(express.static('public'));
6+
7+
app.get('/', function(req, res) {
8+
res.sendFile(path.join(__dirname + '/index.html'));
9+
});
10+
11+
app.listen(8000, () => {
12+
console.log('Server running at http://localhost:8000/');
13+
});

0-base/kubernetes.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: example-nodejs
5+
labels:
6+
app: example-nodejs
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: example-nodejs
11+
template:
12+
metadata:
13+
labels:
14+
app: example-nodejs
15+
spec:
16+
containers:
17+
- name: example-nodejs
18+
image: example-nodejs-image
19+
ports:
20+
- containerPort: 8000

0-base/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "tilt-example-nodejs",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"express": "^4.17.1",
8+
"immutable": "^3.8.2"
9+
},
10+
"devDependencies": {}
11+
}

0-base/public/pets.png

182 KB
Loading

0 commit comments

Comments
 (0)