Files
faas/auth/basic-auth/Dockerfile.arm64
Alex Ellis 14677e0b9a Update alpine shipping versions
Alpine 3.10 is now availabe and is no-harm update.

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2019-08-21 07:40:51 +01:00

35 lines
908 B
Docker

FROM golang:1.10-alpine3.9 as build
RUN apk add --no-cache curl ca-certificates gcc musl-dev
RUN curl -sLSf https://raw.githubusercontent.com/teamserverless/license-check/master/get.sh | sh \
&& mv ./license-check /usr/bin/
WORKDIR /go/src/handler
COPY . .
# Run a gofmt and exclude all vendored code.
RUN license-check -path ./ --verbose=false "OpenFaaS Authors" "OpenFaaS Author(s)" \
&& test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))" \
&& go test $(go list ./... | grep -v /vendor/) -cover && \
CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
FROM alpine:3.10
# Add non-root user
RUN addgroup -S app && adduser -S -g app app \
&& mkdir -p /home/app \
&& chown app /home/app
WORKDIR /home/app
COPY --from=build /go/src/handler/handler .
RUN chown -R app /home/app
USER app
WORKDIR /home/app
CMD ["./handler"]