Created
May 21, 2021 12:49
-
-
Save typewriter/ec31ad362315af9f9e89b413c6cf1b43 to your computer and use it in GitHub Desktop.
GCP Cloud Run と AWS App Runner のスケーリングの様子をみる
This file contains hidden or 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
| FROM golang:latest as builder | |
| WORKDIR /opt/server | |
| COPY . . | |
| RUN CGO_ENABLED=0 GOOS=linux go build -o app main.go | |
| FROM alpine:latest | |
| EXPOSE 8080 | |
| COPY --from=builder /opt/server/app /opt/server/app | |
| CMD ["/opt/server/app"] |
This file contains hidden or 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
| module server | |
| go 1.16 |
This file contains hidden or 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
| #!/bin/bash | |
| URL=$1 | |
| while true | |
| do | |
| printf '%(%H:%M:%S)T: ' | |
| curl -s $URL -w ", time: %{time_starttransfer} s\n" | |
| done |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "os" | |
| "time" | |
| ) | |
| func handler(w http.ResponseWriter, r *http.Request) { | |
| time.Sleep(time.Second * 1) | |
| fmt.Fprintf(w, "%#v", os.Environ()) | |
| } | |
| func main() { | |
| http.HandleFunc("/", handler) | |
| http.ListenAndServe(":8080", nil) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment