initial import

This commit is contained in:
SourceFellows
2020-08-21 06:26:40 +02:00
commit e223458dd4
423 changed files with 9871 additions and 0 deletions

View File

@ -0,0 +1,12 @@
FROM golang:1 as builder
WORKDIR /go/src/app
COPY *.go .
RUN CGO_ENABLED=0 go build .
####################################
FROM alpine
COPY --from=builder /go/src/app/app .
EXPOSE 8080
CMD [ "./app" ]

View File

@ -0,0 +1,11 @@
```
eval $(minikube docker-env)
docker build -t minikube-golang-sample .
kubectl create -f manifest.yml
kubectl get pod
kubectl expose deployment golang-sample --type=NodePort
kubectl get service
minikube service golang-sample --url
```

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"net/http"
"time"
)
func greet(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World! %s", time.Now())
}
func main() {
http.HandleFunc("/", greet)
http.ListenAndServe(":8080", nil)
}

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: golang-sample
name: golang-sample
spec:
replicas: 2
selector:
matchLabels:
app: golang-sample
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: golang-sample
spec:
containers:
- image: minikube-golang-sample
name: golang-sample
imagePullPolicy: Never
resources: {}
ports:
- containerPort: 8080
status: {}