mirror of
https://github.com/openfaas/faas.git
synced 2025-06-26 16:53:26 +00:00
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>
This commit is contained in:
26
auth/basic-auth/Dockerfile
Normal file
26
auth/basic-auth/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
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"]
|
Reference in New Issue
Block a user