forked from che-samples/web-nodejs-sample
-
Notifications
You must be signed in to change notification settings - Fork 6
/
devfile.yaml
67 lines (67 loc) · 1.78 KB
/
devfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
schemaVersion: 2.2.2
metadata:
name: nodejs-web-app
components:
- name: tools
container:
image: registry.redhat.io/devspaces/udi-rhel8:3.18
endpoints:
- exposure: public
name: nodejs
protocol: https
targetPort: 3000
memoryLimit: '1Gi'
memoryRequest: '512Mi'
cpuLimit: '0.5'
cpuRequest: '0.25'
mountSources: true
volumeMounts:
- name: npm
path: /home/user/.npm
- name: npm
volume:
size: 1G
commands:
- id: 1-dependencies
exec:
label: "Download dependencies"
component: tools
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app
commandLine: "npm install"
group:
kind: build
- id: 2-run
exec:
label: "Run the web app"
component: tools
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app
commandLine: "nodemon app.js"
group:
kind: run
- id: 3-install-and-run
exec:
label: "Run the web app (and download dependencies)"
component: tools
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app
commandLine: "npm install; nodemon app.js"
group:
kind: run
- id: 4-debug
exec:
label: "Run the web app (debugging enabled)"
component: tools
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app
commandLine: "nodemon --inspect app.js"
group:
kind: debug
isDefault: true
- id: 5-stopapp
exec:
label: "Stop the web app"
component: tools
commandLine: >-
node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr "\\n" " ") &&
echo "Stopping node server with PIDs: ${node_server_pids}" &&
kill -15 ${node_server_pids} &>/dev/null && echo 'Done.'
group:
kind: run