diff --git a/Dockerfile b/Dockerfile index 6982d03a..40aba21f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM teamserverless/license-check:0.3.6 as license-check -FROM golang:1.11 as build - +FROM golang:1.13 as build +ARG GO111MODULE=off +ARG CGO_ENABLED=0 COPY --from=license-check /license-check /usr/bin/ RUN mkdir -p /go/src/github.com/openfaas/faas-swarm/ @@ -12,16 +13,18 @@ COPY . . RUN license-check -path /go/src/github.com/openfaas/faas-swarm/ --verbose=false "Alex Ellis" "OpenFaaS Author(s)" -RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") \ - && CGO_ENABLED=0 go test $(go list ./... | grep -v /vendor/) -cover \ - && VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \ +RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") + +RUN CGO_ENABLED=$CGO_ENABLED go test $(go list ./... | grep -v /vendor/) -cover + +RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \ && GIT_COMMIT=$(git rev-list -1 HEAD) \ - && CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \ + && CGO_ENABLED=$CGO_ENABLED GOOS=linux go build --ldflags "-s -w \ -X github.com/openfaas/faas-swarm/version.GitCommit=${GIT_COMMIT}\ -X github.com/openfaas/faas-swarm/version.Version=${VERSION}" \ -a -installsuffix cgo -o faas-swarm . -FROM alpine:3.10 as ship +FROM alpine:3.12 as ship LABEL org.label-schema.license="MIT" \ org.label-schema.vcs-url="https://github.com/openfaas/faas-swarm" \ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 6982d03a..ce83cefb 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -1,6 +1,7 @@ FROM teamserverless/license-check:0.3.6 as license-check -FROM golang:1.11 as build +FROM golang:1.13 as build +ARG GO111MODULE=off COPY --from=license-check /license-check /usr/bin/ @@ -21,7 +22,7 @@ RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") \ -X github.com/openfaas/faas-swarm/version.Version=${VERSION}" \ -a -installsuffix cgo -o faas-swarm . -FROM alpine:3.10 as ship +FROM alpine:3.12 as ship LABEL org.label-schema.license="MIT" \ org.label-schema.vcs-url="https://github.com/openfaas/faas-swarm" \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 6982d03a..ce83cefb 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,6 +1,7 @@ FROM teamserverless/license-check:0.3.6 as license-check -FROM golang:1.11 as build +FROM golang:1.13 as build +ARG GO111MODULE=off COPY --from=license-check /license-check /usr/bin/ @@ -21,7 +22,7 @@ RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") \ -X github.com/openfaas/faas-swarm/version.Version=${VERSION}" \ -a -installsuffix cgo -o faas-swarm . -FROM alpine:3.10 as ship +FROM alpine:3.12 as ship LABEL org.label-schema.license="MIT" \ org.label-schema.vcs-url="https://github.com/openfaas/faas-swarm" \ diff --git a/handlers/namespace.go b/handlers/namespace.go index f39b0c50..b503208e 100644 --- a/handlers/namespace.go +++ b/handlers/namespace.go @@ -23,4 +23,3 @@ func NamespaceLister() http.HandlerFunc { w.Write(nsJSON) } } - diff --git a/main.go b/main.go index 248c1512..c8b1bc62 100644 --- a/main.go +++ b/main.go @@ -53,19 +53,18 @@ func main() { funcProxyHandler := handlers.NewFunctionLookup(dockerClient, cfg.DNSRoundRobin) bootstrapHandlers := bootTypes.FaaSHandlers{ - DeleteHandler: handlers.DeleteHandler(dockerClient), - DeployHandler: handlers.DeployHandler(dockerClient, maxRestarts, restartDelay), - FunctionReader: handlers.FunctionReader(true, dockerClient), - FunctionProxy: proxy.NewHandlerFunc(cfg.FaaSConfig, funcProxyHandler), - ReplicaReader: handlers.ReplicaReader(dockerClient), - ReplicaUpdater: handlers.ReplicaUpdater(dockerClient), - UpdateHandler: handlers.UpdateHandler(dockerClient, maxRestarts, restartDelay), - HealthHandler: handlers.Health(), - InfoHandler: handlers.MakeInfoHandler(version.BuildVersion(), version.GitCommit), - SecretHandler: handlers.MakeSecretsHandler(dockerClient), - LogHandler: logs.NewLogHandlerFunc(handlers.NewLogRequester(dockerClient), cfg.FaaSConfig.WriteTimeout), + DeleteHandler: handlers.DeleteHandler(dockerClient), + DeployHandler: handlers.DeployHandler(dockerClient, maxRestarts, restartDelay), + FunctionReader: handlers.FunctionReader(true, dockerClient), + FunctionProxy: proxy.NewHandlerFunc(cfg.FaaSConfig, funcProxyHandler), + ReplicaReader: handlers.ReplicaReader(dockerClient), + ReplicaUpdater: handlers.ReplicaUpdater(dockerClient), + UpdateHandler: handlers.UpdateHandler(dockerClient, maxRestarts, restartDelay), + HealthHandler: handlers.Health(), + InfoHandler: handlers.MakeInfoHandler(version.BuildVersion(), version.GitCommit), + SecretHandler: handlers.MakeSecretsHandler(dockerClient), + LogHandler: logs.NewLogHandlerFunc(handlers.NewLogRequester(dockerClient), cfg.FaaSConfig.WriteTimeout), ListNamespaceHandler: handlers.NamespaceLister(), - } bootstrapConfig := bootTypes.FaaSConfig{