Repository navigation
Expand file tree
/
Copy pathdevfile.yaml
More file actions
52 lines (52 loc) · 1.53 KB
/
Copy pathdevfile.yaml
File metadata and controls
52 lines (52 loc) · 1.53 KB
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
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.access.redhat.com/ubi9/nodejs-18:latest'
memoryLimit: 512Mi
endpoints:
- name: nodejs
port: 8080
mountSources: true
commands:
- name: 1. Install dependencies
actions:
- type: exec
component: nodejs
command: npm install
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app'
- name: 2. Run the web app (dev mode)
actions:
- type: exec
component: nodejs
command: npm run dev
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app'
- name: 3. Build the web app
actions:
- type: exec
component: nodejs
command: npm run build
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app'
- name: 4. Run the web app (production)
actions:
- type: exec
component: nodejs
command: npm start
workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app'
- name: 5. Stop the web app
actions:
- type: exec
component: nodejs
command: 'node_server_pids=$(pgrep -f "next" | tr "\\n" " ") && echo "Stopping Next.js with PIDs: ${node_server_pids}" && kill -15 ${node_server_pids} &>/dev/null && echo ''Done.'''