File tree Expand file tree Collapse file tree 4 files changed +159
-0
lines changed Expand file tree Collapse file tree 4 files changed +159
-0
lines changed Original file line number Diff line number Diff line change 1+ schemaVersion : 2.2.2
2+ metadata :
3+ name : go
4+ displayName : Go Runtime
5+ description : Go (version 1.21.x) is an open source programming language that makes it easy to build simple, reliable, and efficient software.
6+ icon : https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
7+ tags :
8+ - Go
9+ projectType : Go
10+ language : Go
11+ provider : Red Hat
12+ version : 2.4.0
13+ starterProjects :
14+ - name : go-starter
15+ description : A Go project with a simple HTTP server
16+ git :
17+ checkoutFrom :
18+ revision : main
19+ remotes :
20+ origin : https://github.com/devfile-samples/devfile-stack-go.git
21+ components :
22+ - name : build
23+ image :
24+ imageName : go-image:latest
25+ dockerfile :
26+ uri : docker/Dockerfile
27+ buildContext : .
28+ rootRequired : false
29+ - name : deploy
30+ kubernetes :
31+ uri : kubernetes/deploy.yaml
32+ endpoints :
33+ - name : http-8081
34+ targetPort : 8081
35+ - container :
36+ endpoints :
37+ - name : https-go
38+ protocol : https
39+ targetPort : 8080
40+ - exposure : none
41+ name : debug
42+ targetPort : 5858
43+ image : registry.access.redhat.com/ubi9/go-toolset:1.21.9-1.1714671022
44+ args : ['tail', '-f', '/dev/null']
45+ env :
46+ - name : DEBUG_PORT
47+ value : ' 5858'
48+ memoryLimit : 1024Mi
49+ mountSources : true
50+ name : runtime
51+ commands :
52+ - id : build-image
53+ apply :
54+ component : build
55+ - id : deployk8s
56+ apply :
57+ component : deploy
58+ - id : deploy
59+ composite :
60+ commands :
61+ - build-image
62+ - deployk8s
63+ group :
64+ kind : deploy
65+ isDefault : true
66+ - exec :
67+ env :
68+ - name : GOPATH
69+ value : ${PROJECT_SOURCE}/.go
70+ - name : GOCACHE
71+ value : ${PROJECT_SOURCE}/.cache
72+ commandLine : go build main.go
73+ component : runtime
74+ group :
75+ isDefault : true
76+ kind : build
77+ workingDir : ${PROJECT_SOURCE}
78+ id : build
79+ - exec :
80+ commandLine : ./main
81+ component : runtime
82+ group :
83+ isDefault : true
84+ kind : run
85+ workingDir : ${PROJECT_SOURCE}
86+ id : run
87+
88+ - exec :
89+ commandLine : |
90+ GOPATH=${PROJECT_SOURCE}/.go \
91+ GOCACHE=${PROJECT_SOURCE}/.cache \
92+ dlv \
93+ --listen=127.0.0.1:${DEBUG_PORT} \
94+ --only-same-user=false \
95+ --headless=true \
96+ --api-version=2 \
97+ --accept-multiclient \
98+ debug --continue main.go
99+ component : runtime
100+ group :
101+ isDefault : true
102+ kind : debug
103+ workingDir : ${PROJECT_SOURCE}
104+ id : debug
Original file line number Diff line number Diff line change 1+ FROM registry.access.redhat.com/ubi9/go-toolset:1.21.9-1.1714671022
2+
3+ COPY go.mod ./
4+ RUN go mod download
5+
6+ COPY *.go ./
7+
8+ RUN go build -o ./main
9+
10+ EXPOSE 8081
11+
12+ CMD [ "./main" , "-p=8081" ]
Original file line number Diff line number Diff line change 1+ kind : Service
2+ apiVersion : v1
3+ metadata :
4+ name : my-go-svc
5+ spec :
6+ ports :
7+ - name : http-8081
8+ port : 8081
9+ protocol : TCP
10+ targetPort : 8081
11+ selector :
12+ app : go-app
13+ ---
14+ kind : Deployment
15+ apiVersion : apps/v1
16+ metadata :
17+ name : my-go
18+ spec :
19+ replicas : 1
20+ selector :
21+ matchLabels :
22+ app : go-app
23+ template :
24+ metadata :
25+ labels :
26+ app : go-app
27+ spec :
28+ containers :
29+ - name : my-go
30+ image : go-image:latest
31+ ports :
32+ - name : http
33+ containerPort : 8081
34+ protocol : TCP
35+ resources :
36+ requests :
37+ memory : " 10Mi"
38+ cpu : " 10m"
39+ limits :
40+ memory : " 100Mi"
41+ cpu : " 100m"
Original file line number Diff line number Diff line change @@ -22,3 +22,5 @@ versions:
2222 - version : 2.2.0
2323 # 2.3.0: debug command via dlv & go 1.20
2424 - version : 2.3.0
25+ # 2.4.0: debug command via dlv & go 1.21
26+ - version : 2.4.0
You can’t perform that action at this time.
0 commit comments