mirror of
https://github.com/openfaas/faas.git
synced 2025-06-26 00:33:25 +00:00
Convert Basic-Auth to multi-arch
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
This commit is contained in:
@ -10,42 +10,39 @@ ARG BUILDPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
ARG GIT_COMMIT_SHA
|
||||
ARG GIT_COMMIT
|
||||
ARG GIT_COMMIT_MESSAGE
|
||||
ARG VERSION='dev'
|
||||
ARG VERSION
|
||||
|
||||
COPY --from=license-check /license-check /usr/bin/
|
||||
|
||||
WORKDIR /go/src/github.com/openfaas/faas/gateway
|
||||
|
||||
COPY gateway/vendor vendor
|
||||
COPY vendor vendor
|
||||
|
||||
COPY gateway/handlers handlers
|
||||
COPY gateway/metrics metrics
|
||||
COPY gateway/requests requests
|
||||
COPY gateway/tests tests
|
||||
COPY handlers handlers
|
||||
COPY metrics metrics
|
||||
COPY requests requests
|
||||
COPY tests tests
|
||||
|
||||
COPY gateway/types types
|
||||
COPY gateway/queue queue
|
||||
COPY gateway/plugin plugin
|
||||
COPY gateway/version version
|
||||
COPY gateway/scaling scaling
|
||||
COPY gateway/pkg pkg
|
||||
COPY gateway/main.go .
|
||||
COPY .git .
|
||||
COPY types types
|
||||
COPY queue queue
|
||||
COPY plugin plugin
|
||||
COPY version version
|
||||
COPY scaling scaling
|
||||
COPY pkg pkg
|
||||
COPY main.go .
|
||||
RUN license-check -path ./ --verbose=false "Alex Ellis" "OpenFaaS Authors" "OpenFaaS Author(s)"
|
||||
|
||||
|
||||
# Run a gofmt and exclude all vendored code.
|
||||
RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))"
|
||||
RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test $(go list ./... | grep -v integration | grep -v /vendor/ | grep -v /template/) -cover
|
||||
RUN GIT_COMMIT_MESSAGE=$(git log -1 --pretty=%B 2>&1 | head -n 1) \
|
||||
GIT_COMMIT_SHA=$(git rev-list -1 HEAD) \
|
||||
VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///' || echo dev) \
|
||||
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build --ldflags "-s -w \
|
||||
-X github.com/openfaas/faas/gateway/version.GitCommitSHA=${GIT_COMMIT_SHA} \
|
||||
-X github.com/openfaas/faas/gateway/version.GitCommitMessage=${GIT_COMMIT_MESSAGE} \
|
||||
-X github.com/openfaas/faas/gateway/version.Version=${VERSION} \
|
||||
RUN go test $(go list ./... | grep -v integration | grep -v /vendor/ | grep -v /template/) -cover
|
||||
|
||||
RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build --ldflags "-s -w \
|
||||
-X \"github.com/openfaas/faas/gateway/version.GitCommitSHA=${GIT_COMMIT}\" \
|
||||
-X \"github.com/openfaas/faas/gateway/version.GitCommitMessage=${GIT_COMMIT_MESSAGE}\" \
|
||||
-X \"github.com/openfaas/faas/gateway/version.Version=${VERSION}\" \
|
||||
-X github.com/openfaas/faas/gateway/types.Arch=${TARGETARCH}" \
|
||||
-a -installsuffix cgo -o gateway .
|
||||
|
||||
@ -70,7 +67,7 @@ ENV http_proxy ""
|
||||
ENV https_proxy ""
|
||||
|
||||
COPY --from=build /go/src/github.com/openfaas/faas/gateway/gateway .
|
||||
COPY gateway/assets assets
|
||||
COPY assets assets
|
||||
RUN sed -ie s/x86_64/${GOARCH}/g assets/script/funcstore.js && \
|
||||
rm assets/script/funcstore.jse
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
.PHONY: all build push
|
||||
TAG?=latest
|
||||
NS?=openfaas
|
||||
|
||||
all: build
|
||||
build:
|
||||
./build.sh ${TAG} ${NS}
|
||||
push:
|
||||
./push.sh ${TAG} ${NS}
|
@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
export arch=$(uname -m)
|
||||
|
||||
export eTAG="latest-dev"
|
||||
|
||||
if [ "$arch" = "armv7l" ] ; then
|
||||
eTAG="latest-armhf-dev"
|
||||
elif [ "$arch" = "aarch64" ] ; then
|
||||
eTAG="latest-arm64-dev"
|
||||
fi
|
||||
|
||||
echo "$1"
|
||||
if [ "$1" ] ; then
|
||||
eTAG=$1
|
||||
if [ "$arch" = "armv7l" ] ; then
|
||||
eTAG="$1-armhf"
|
||||
elif [ "$arch" = "aarch64" ] ; then
|
||||
eTAG="$1-arm64"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$2" ] ; then
|
||||
NS=$2
|
||||
else
|
||||
NS=openfaas
|
||||
fi
|
||||
|
||||
echo Pushing $NS/gateway:$eTAG
|
||||
|
||||
docker push $NS/gateway:$eTAG
|
||||
|
Reference in New Issue
Block a user