mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
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>
27 lines
590 B
Docker
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"]
|