diff --git a/Dockerfile b/Dockerfile index 8158be0..a6daba2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM docker.io/golang:bullseye@sha256:8d717e8a7fa8035f5cfdcdc86811ffd53b7bb17542f419f2a121c4c7533d29ee as builder +FROM docker.io/golang:1.23 as builder COPY . /app WORKDIR /app +RUN go test ./... RUN GOOS=linux GOARCH=amd64 go build -o dist/ -FROM gcr.io/distroless/static-debian11@sha256:8ad6f3ec70dad966479b9fb48da991138c72ba969859098ec689d1450c2e6c97 +FROM gcr.io/distroless/static-debian12:latest COPY --from=builder /app/dist/mkcert /bin/mkcert USER 1001 CMD ["/bin/mkcert"] diff --git a/body/parser.go b/body/parser.go index 3bb7ea6..7fc810d 100644 --- a/body/parser.go +++ b/body/parser.go @@ -17,13 +17,13 @@ package body import ( "encoding/json" "errors" - "github.com/Lukasa/mkcert/certs" "io" - "io/ioutil" "log" "mime" "mime/multipart" "strings" + + "github.com/Lukasa/mkcert/certs" ) var ( @@ -98,7 +98,7 @@ func ParseMultipartBody(f io.Reader, boundary string) ([]string, []*certs.Certif label = labelVals[0] } - body, err := ioutil.ReadAll(p) + body, err := io.ReadAll(p) if err != nil { log.Printf("Unexpected IO error: %v.\n", err) return nil, nil, err diff --git a/go.mod b/go.mod index 7481e82..a4bcfd5 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/Lukasa/mkcert -go 1.17 +go 1.23 diff --git a/main.go b/main.go index bb6908c..708d3cf 100644 --- a/main.go +++ b/main.go @@ -17,14 +17,14 @@ package main import ( "encoding/json" "fmt" - "github.com/Lukasa/mkcert/certs" "io" "log" "net/http" - "runtime" "strings" "sync" "time" + + "github.com/Lukasa/mkcert/certs" ) const CERT_URL = "https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt" @@ -237,9 +237,6 @@ func listAllCerts(w http.ResponseWriter, r *http.Request) { } func main() { - // Before we do anything, TURN ON THE CPUS. - runtime.GOMAXPROCS(runtime.NumCPU()) - // Start the certificate update loop. go certUpdateLoop()