Skip to content

Commit 235178a

Browse files
committed
Initial commit
0 parents  commit 235178a

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM golang:1.19 as builder
2+
WORKDIR /code
3+
4+
COPY main.go .
5+
COPY go.mod .
6+
COPY go.sum .
7+
RUN go mod download
8+
9+
COPY *.go ./
10+
11+
# `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations
12+
ARG SKAFFOLD_GO_GCFLAGS
13+
RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -trimpath -o /app main.go
14+
15+
FROM gcr.io/distroless/base-debian10
16+
# Define GOTRACEBACK to mark this container as using the Go language runtime
17+
# for `skaffold debug` (https://skaffold.dev/docs/workflows/debug/).
18+
ENV GOTRACEBACK=single
19+
EXPOSE 80
20+
CMD ["./app"]
21+
COPY --from=builder /app .

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module more-metrics
2+
3+
go 1.19

main.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
)
7+
8+
func main() {
9+
http.HandleFunc("/", HelloServer)
10+
http.ListenAndServe(":80", nil)
11+
}
12+
13+
func HelloServer(w http.ResponseWriter, r *http.Request) {
14+
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
15+
}

0 commit comments

Comments
 (0)