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/v0.5-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
# COPY fwatchdog /usr/bin/
WORKDIR /go/src/github.com/openfaas/faas/sample-functions/WebhookStash
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/WebhookStash /usr/bin/WebhookStash
ENV fprocess "/usr/bin/WebhookStash"
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 go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
CMD ["/bin/true"]

View File

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