forked from stuartwdouglas/multi-platform-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stephanie <yangcao@redhat.com>
- Loading branch information
0 parents
commit 8c27a59
Showing
8 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: my-go | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: go-app | ||
template: | ||
metadata: | ||
labels: | ||
app: go-app | ||
spec: | ||
containers: | ||
- name: my-go | ||
image: go-image:latest | ||
ports: | ||
- name: http | ||
containerPort: 8081 | ||
protocol: TCP | ||
resources: | ||
limits: | ||
memory: "1024Mi" | ||
cpu: "500m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.odo/env | ||
.odo/odo-file-index.json | ||
main | ||
.idea/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:1.16-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod ./ | ||
RUN go mod download | ||
|
||
COPY *.go ./ | ||
|
||
RUN go build -o /main | ||
|
||
EXPOSE 8081 | ||
|
||
CMD [ "/main" , "-p=8081"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# devfile-sample-go-basic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
schemaVersion: 2.2.0 | ||
metadata: | ||
name: go | ||
language: go | ||
projectType: go | ||
tags: | ||
- Go | ||
version: 1.0.0 | ||
provider: Red Hat | ||
supportUrl: https://github.com/devfile-samples/devfile-support#support-information | ||
attributes: | ||
alpha.dockerimage-port: 8081 | ||
parent: | ||
id: go | ||
registryUrl: "https://registry.devfile.io" | ||
components: | ||
- name: outerloop-build | ||
image: | ||
imageName: go-image:latest | ||
dockerfile: | ||
uri: docker/Dockerfile | ||
buildContext: . | ||
rootRequired: false | ||
- name: outerloop-deploy | ||
kubernetes: | ||
uri: outerloop-deploy.yaml | ||
commands: | ||
- id: build-image | ||
apply: | ||
component: outerloop-build | ||
- id: deployk8s | ||
apply: | ||
component: outerloop-deploy | ||
- id: deploy | ||
composite: | ||
commands: | ||
- build-image | ||
- deployk8s | ||
group: | ||
kind: deploy | ||
isDefault: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:1.16-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod ./ | ||
RUN go mod download | ||
|
||
COPY *.go ./ | ||
|
||
RUN go build -o /main | ||
|
||
EXPOSE 8081 | ||
|
||
CMD [ "/main" , "-p=8081"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/schultzp2020/devfile-starter-projects/go | ||
|
||
go 1.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"flag" | ||
) | ||
var port = flag.Int("p", 8080, "server port") | ||
|
||
func main() { | ||
flag.Parse() | ||
http.HandleFunc("/", HelloServer) | ||
http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", *port), nil) | ||
} | ||
|
||
func HelloServer(w http.ResponseWriter, r *http.Request) { | ||
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:]) | ||
} |