Bump samples/versions - reduce image sizes through multi-stage builds

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2017-11-09 10:39:00 +00:00
parent f62309f388
commit a077dd7627
736 changed files with 177333 additions and 185 deletions

View File

@ -1,16 +1,26 @@
FROM alpine:latest
FROM golang:1.9.2-alpine as builder
WORKDIR /root/
MAINTAINER alex@openfaas.com
ENTRYPOINT []
EXPOSE 8080
ENV http_proxy ""
ENV https_proxy ""
RUN apk --no-cache add make curl \
&& curl -sL https://github.com/openfaas/faas/releases/download/0.6.9/fwatchdog > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog
ADD https://github.com/openfaas/faas/releases/download/0.5.1-alpha/fwatchdog /usr/bin
# COPY fwatchdog /usr/bin/
RUN chmod +x /usr/bin/fwatchdog
WORKDIR /go/src/github.com/openfaas/faas/sample-functions/ApiKeyProtected
COPY app .
COPY handler.go .
# COPY vendor vendor
ENV fprocess="/root/app"
CMD ["fwatchdog"]
RUN go install
FROM alpine:3.6
# Needed to reach the hub
RUN apk --no-cache add ca-certificates
COPY --from=builder /usr/bin/fwatchdog /usr/bin/fwatchdog
COPY --from=builder /go/bin/ApiKeyProtected /usr/bin/ApiKeyProtected
ENV fprocess "/usr/bin/ApiKeyProtected"
CMD ["/usr/bin/fwatchdog"]

View File

@ -1,9 +0,0 @@
FROM golang:1.7.5
RUN mkdir -p /go/src/app
COPY handler.go /go/src/app
WORKDIR /go/src/app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
CMD ["echo"]

View File

@ -1,12 +0,0 @@
#!/bin/sh
echo Building functions/api-key-protected:build
docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \
-t functions/api-key-protected . -f Dockerfile.build
docker create --name render_extract functions/api-key-protected
docker cp render_extract:/go/src/app/app ./app
docker rm -f render_extract
echo Building functions/api-key-protected:latest
docker build --no-cache -t functions/api-key-protected:latest .