File tree Expand file tree Collapse file tree 6 files changed +50
-20
lines changed Expand file tree Collapse file tree 6 files changed +50
-20
lines changed Original file line number Diff line number Diff line change 11FROM openfaas/classic-watchdog:0.18.1 as watchdog
2- FROM golang:1.12 -alpine3.11 as builder
2+ FROM golang:1.13 -alpine3.11 as builder
33
44# Allows you to add additional packages via build-arg
55ARG ADDITIONAL_PACKAGE
66ARG CGO_ENABLED=0
77ARG GO111MODULE="off"
88ARG GOPROXY=""
9+ ARG GOFLAGS=""
910
1011COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
1112RUN chmod +x /usr/bin/fwatchdog
1213
14+ ENV CGO_ENABLED=0
15+
1316WORKDIR /go/src/handler
1417COPY . .
1518
19+ # Add user overrides to the root go.mod, which is the only place "replace" can be used
20+ RUN cat function/GO_REPLACE.txt >> ./go.mod || exit 0
21+
1622# Run a gofmt and exclude all vendored code.
1723RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path " ./vendor/*" -not -path " ./function/vendor/*"))" || { echo "Run \" gofmt -s -w\" on your Golang code" ; exit 1; }
1824
25+ WORKDIR /go/src/handler/function
26+
27+ RUN go test ./... -cover
28+
29+ WORKDIR /go/src/handler
30+
1931RUN CGO_ENABLED=${CGO_ENABLED} GOOS=linux \
20- go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
21- go test $(go list ./... | grep -v /vendor/) -cover
32+ go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
2233
2334FROM alpine:3.11
24- RUN apk --no-cache add \
25- ca-certificates
26-
27- # Add non root user
28- RUN addgroup -S app && adduser -S -g app app
29- RUN mkdir -p /home/app
35+ RUN apk --no-cache add ca-certificates \
36+ && addgroup -S app && adduser -S -g app app \
37+ && mkdir -p /home/app \
38+ && chown app /home/app
3039
3140WORKDIR /home/app
3241
Original file line number Diff line number Diff line change 1+ module handler
2+
3+ go 1.13
4+
5+ replace handler/function => ./function
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ package main
66
77import (
88 "fmt"
9- "handler/function"
109 "io/ioutil"
1110 "log"
1211 "os"
12+
13+ "handler/function"
1314)
1415
1516func main () {
Original file line number Diff line number Diff line change 11FROM openfaas/classic-watchdog:0.18.1 as watchdog
2- FROM golang:1.12 -alpine3.11 as builder
2+ FROM golang:1.13 -alpine3.11 as builder
33
44# Allows you to add additional packages via build-arg
55ARG ADDITIONAL_PACKAGE
66ARG CGO_ENABLED=0
77ARG GO111MODULE="off"
88ARG GOPROXY=""
9+ ARG GOFLAGS=""
910
1011COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
1112RUN chmod +x /usr/bin/fwatchdog
1213
14+ ENV CGO_ENABLED=0
15+
1316WORKDIR /go/src/handler
1417COPY . .
1518
19+ # Add user overrides to the root go.mod, which is the only place "replace" can be used
20+ RUN cat function/GO_REPLACE.txt >> ./go.mod || exit 0
21+
1622# Run a gofmt and exclude all vendored code.
1723RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path " ./vendor/*" -not -path " ./function/vendor/*"))" || { echo "Run \" gofmt -s -w\" on your Golang code" ; exit 1; }
1824
25+ WORKDIR /go/src/handler/function
26+
27+ RUN go test ./... -cover
28+
29+ WORKDIR /go/src/handler
30+
1931RUN CGO_ENABLED=${CGO_ENABLED} GOOS=linux \
20- go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
21- go test $(go list ./... | grep -v /vendor/) -cover
32+ go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
2233
2334FROM alpine:3.11
24- RUN apk --no-cache add \
25- ca-certificates
26-
27- # Add non root user
28- RUN addgroup -S app && adduser -S -g app app
29- RUN mkdir -p /home/app
35+ RUN apk --no-cache add ca-certificates \
36+ && addgroup -S app && adduser -S -g app app \
37+ && mkdir -p /home/app \
38+ && chown app /home/app
3039
3140WORKDIR /home/app
3241
Original file line number Diff line number Diff line change 1+ module handler
2+
3+ go 1.13
4+
5+ replace handler/function => ./function
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ package main
66
77import (
88 "fmt"
9- "handler/function"
109 "io/ioutil"
1110 "log"
1211 "os"
12+
13+ "handler/function"
1314)
1415
1516func main () {
You can’t perform that action at this time.
0 commit comments