add go example

This commit is contained in:
Lance Vick 2023-11-01 16:55:11 -07:00
parent 67cd263c69
commit cde7ce9346
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,9 @@
ARG GO_IMAGE=ocirep:go
FROM ${GO_IMAGE} as build
COPY . .
RUN cargo build main.go
ARG CA_IMAGE=ocirep:ca-certificates
FROM scratch
COPY --from=${CA_IMAGE} /
COPY --from=build main .

View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", HelloServer)
http.ListenAndServe(":8080", nil)
}
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
}