Skip to content

Commit aad90b0

Browse files
authored
Merge pull request #1148 from mfornasa/feature/nodejs
Node.js example with dependency handling and hot-reload
2 parents ea5382d + 85ed343 commit aad90b0

File tree

9 files changed

+2993
-0
lines changed

9 files changed

+2993
-0
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== Example: Node.js with hot-reload
2+
:icons: font
3+
4+
Simple example based on Node.js demonstrating the file synchronization mode.
5+
6+
==== Init
7+
`skaffold dev`
8+
9+
==== Workflow
10+
* Make some changes to `index.js`:
11+
** The file will be synchronized to the cluster
12+
** `nodemon` will restart the application
13+
* Make some changes to `package.json`:
14+
** The full build/push/deploy process will be triggered, fetching dependencies from `npm`
15+
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
*.swp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
*.swp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:8.12.0-alpine
2+
3+
WORKDIR /opt/backend
4+
CMD ["npm", "run", "dev"]
5+
6+
COPY . .
7+
RUN npm install
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const express = require('express')
2+
const app = express()
3+
const port = 3000
4+
5+
app.get('/', (req, res) => res.send('Hello World!'))
6+
7+
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: node
5+
spec:
6+
containers:
7+
- name: node
8+
image: gcr.io/k8s-skaffold/node-example
9+
ports:
10+
- containerPort: 3000

0 commit comments

Comments
 (0)