forked from modernizing-java-applications-book/web-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 5
/
devfile.yaml
70 lines (70 loc) · 2.22 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
68
69
70
apiVersion: 1.0.0
metadata:
generateName: web-nodejs-
projects:
- name: nodejs-web-app
source:
type: git
location: 'https://github.com/modernizing-java-applications-book/web-nodejs.git'
branch: main
components:
- type: chePlugin
id: vscode/typescript-language-features/latest
- type: chePlugin
id: ms-vscode/node-debug2/latest
- type: dockerimage
alias: nodejs
image: 'registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:1c4faa2dae80c373f606f542ca841f991d1dfa27979006500aca85e3c2999d2d'
memoryLimit: 512Mi
endpoints:
- name: nodejs
port: 3000
mountSources: true
commands:
- name: 1. Run the web app (and download dependencies)
actions:
- type: exec
component: nodejs
command: npm install; nodemon app.js
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
- name: 2. Download dependencies
actions:
- type: exec
component: nodejs
command: npm install
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
- name: 3. Run the web app
actions:
- type: exec
component: nodejs
command: nodemon app.js
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
- name: 4. Run the web app (debugging enabled)
actions:
- type: exec
component: nodejs
command: nodemon --inspect app.js
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
- name: 5. Stop the web app
actions:
- type: exec
component: nodejs
command: '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.'''
- name: Attach remote debugger
actions:
- type: vscode-launch
referenceContent: |
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"address": "localhost",
"port": 9229,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}