Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Commit

Permalink
Update Go SDK and Alpine runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Sep 24, 2020
1 parent c41cbfa commit e7e8454
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand All @@ -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" \
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -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/

Expand All @@ -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" \
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -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/

Expand All @@ -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" \
Expand Down
1 change: 0 additions & 1 deletion handlers/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ func NamespaceLister() http.HandlerFunc {
w.Write(nsJSON)
}
}

23 changes: 11 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit e7e8454

Please sign in to comment.