faas/auth/basic-auth/Dockerfile
Alex Ellis 02cf70c6f5 Add basic auth plugin
This plugin can be tested as a stand-alone Golang app, or
deployed as a Docker image with the following image:
openfaas/basic-auth-plugin:0.1.0

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2019-06-05 18:13:39 +01:00

27 lines
590 B
Docker

FROM golang:1.10.4-alpine3.8 as build
RUN mkdir -p /go/src/handler
WORKDIR /go/src/handler
COPY . .
RUN CGO_ENABLED=0 GOOS=linux \
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
go test $(go list ./... | grep -v /vendor/) -cover
FROM alpine:3.9
# Add non root user and certs
RUN apk --no-cache add ca-certificates \
&& 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
CMD ["/go/src/handler/handler"]