forked from coolstore-demo/inventory-quarkus
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.devfile.yaml
60 lines (60 loc) · 2.09 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
schemaVersion: 2.2.0
metadata:
name: inventory-quarkus
attributes:
controller.devfile.io/storage-type: ephemeral
parent:
# uri: https://registry.devfile.io/devfiles/java-maven/1.2.0
id: java-maven
registryUrl: https://registry.devfile.io/
version: 1.2.0
commands:
- id: buildimage
exec:
label: "4. Build Image"
component: tools
workingDir: ${PROJECT_SOURCE}
commandLine: |
# NAMESPACE=openshift
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
IMAGE=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/quarkus-api-example
podman build -f src/main/docker/Dockerfile.jvm -t "${IMAGE}" .
group:
kind: build
- id: pushimage
exec:
label: "5. Push Image"
component: tools
commandLine: |
# Requires `oc policy add-role-to-user registry-editor <user_name> -n <namespace>`
# NAMESPACE=openshift
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
IMAGE=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/quarkus-api-example
podman login --tls-verify=false -u $(oc whoami) -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
podman push --tls-verify=false "${IMAGE}"
group:
kind: build
- id: runpod
exec:
label: "6. Run Pod"
component: tools
commandLine: |
# NAMESPACE=openshift
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
IMAGE=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/quarkus-api-example
oc run inventory-quarkus --image "${IMAGE}" --port 8080
oc expose pod/inventory-quarkus
echo
echo
echo "You can now test the application running 'curl -sSL http://inventory-quarkus:8080/api/inventory/100000'"
group:
kind: build
- id: deletepod
exec:
label: "7. Delete Pod"
component: tools
commandLine: |
oc delete pod inventory-quarkus &&
oc delete service inventory-quarkus
group:
kind: build