-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevfile.yaml
100 lines (99 loc) · 2.6 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
apiVersion: 1.0.0
metadata:
generateName: serverless-knative-
projects:
-
name: serverless-knative
source:
type: git
location: "https://github.com/openshift-labs/serverless-devfile.git"
components:
-
type: chePlugin
id: che-incubator/typescript/latest
memoryLimit: 512Mi
-
type: chePlugin
id: ms-vscode/node-debug2/latest
-
type: dockerimage
alias: nodejs
image: quay.io/osevg/che-nodejs10-serverless-ubi:latest
volumes:
- name: workaround
containerPath: /tmp
memoryLimit: 512Mi
endpoints:
- name: 'nodejs'
port: 3000
mountSources: true
commands:
-
name: download dependencies
actions:
- type: exec
component: nodejs
command: npm install
workdir: ${CHE_PROJECTS_ROOT}/serverless-knative/src
-
name: run the web app
actions:
- type: exec
component: nodejs
command: nodemon app.js
workdir: ${CHE_PROJECTS_ROOT}/serverless-knative/src
-
name: run the web app (debugging enabled)
actions:
- type: exec
component: nodejs
command: nodemon --inspect app.js
workdir: ${CHE_PROJECTS_ROOT}/src
-
name: 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}"
}
]
}
-
name: Deploy Function
actions:
- type: exec
component: nodejs
command: >-
read -p 'Enter your serverless.com ACCESS_KEY:' access_key;
export SERVERLESS_ACCESS_KEY=$access_key;
unset KUBERNETES_PORT;
set -o xtrace;
serverless deploy --verbose --debug
workdir: ${CHE_PROJECTS_ROOT}/serverless-knative
-
name: Serverless.com Login
actions:
- type: exec
component: nodejs
command: serverless login
workdir: ${CHE_PROJECTS_ROOT}/serverless-knative