Skip to content

Commit 619ce2c

Browse files
committed
Update versions
- both templates should use the latest of-watchdog and the same Go version for the SDK and the same version of Alpine Linux for the runtime i.e. 3.8 Tested both variants with Docker Swarm locally. Signed-off-by: Alex Ellis (VMware) <[email protected]>
1 parent 560c2f9 commit 619ce2c

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
22
test
33
test.yml
4+
5+
template

template/golang-http/Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
FROM golang:1.9.2-alpine3.6
1+
FROM golang:1.10.4-alpine3.8 as build
22

3-
# Alternatively use ADD https:// (which will not be cached by Docker builder)
43
RUN apk --no-cache add curl \
54
&& echo "Pulling watchdog binary from Github." \
65
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.0/of-watchdog > /usr/bin/fwatchdog \
@@ -18,19 +17,18 @@ RUN CGO_ENABLED=0 GOOS=linux \
1817
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
1918
go test $(go list ./... | grep -v /vendor/) -cover
2019

21-
FROM alpine:3.6
22-
RUN apk --no-cache add ca-certificates
23-
24-
# Add non root user
25-
RUN addgroup -S app && adduser -S -g app app
26-
RUN mkdir -p /home/app
27-
RUN chown app /home/app
20+
FROM alpine:3.8
21+
# Add non root user and certs
22+
RUN apk --no-cache add ca-certificates \
23+
&& addgroup -S app && adduser -S -g app app \
24+
&& mkdir -p /home/app \
25+
&& chown app /home/app
2826

2927
WORKDIR /home/app
3028

31-
COPY --from=0 /go/src/handler/handler .
32-
COPY --from=0 /usr/bin/fwatchdog .
33-
# RUN apk add --no-cache curl
29+
COPY --from=build /go/src/handler/handler .
30+
COPY --from=build /usr/bin/fwatchdog .
31+
3432
USER app
3533

3634
ENV fprocess="./handler"

template/golang-middleware/Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
FROM golang:1.10.4-alpine3.8
1+
FROM golang:1.10.4-alpine3.8 as build
22

3-
# Alternatively use ADD https:// (which will not be cached by Docker builder)
43
RUN apk --no-cache add curl \
54
&& echo "Pulling watchdog binary from Github." \
6-
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.2.7/of-watchdog > /usr/bin/fwatchdog \
5+
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.0/of-watchdog > /usr/bin/fwatchdog \
76
&& chmod +x /usr/bin/fwatchdog \
87
&& apk del curl --no-cache
98

@@ -19,18 +18,17 @@ RUN CGO_ENABLED=0 GOOS=linux \
1918
go test $(go list ./... | grep -v /vendor/) -cover
2019

2120
FROM alpine:3.8
22-
RUN apk --no-cache add ca-certificates
23-
24-
# Add non root user
25-
RUN addgroup -S app && adduser -S -g app app
26-
RUN mkdir -p /home/app
27-
RUN chown app /home/app
21+
# Add non root user and certs
22+
RUN apk --no-cache add ca-certificates \
23+
&& addgroup -S app && adduser -S -g app app \
24+
&& mkdir -p /home/app \
25+
&& chown app /home/app
2826

2927
WORKDIR /home/app
3028

31-
COPY --from=0 /go/src/handler/handler .
32-
COPY --from=0 /usr/bin/fwatchdog .
33-
# RUN apk add --no-cache curl
29+
COPY --from=build /go/src/handler/handler .
30+
COPY --from=build /usr/bin/fwatchdog .
31+
3432
USER app
3533

3634
ENV fprocess="./handler"

0 commit comments

Comments
 (0)