Skip to content

Commit 515e59a

Browse files
bmcustodioalexellis
authored andcommitted
Add opt-in support for using Go modules.
Signed-off-by: Bruno Miguel Custódio <[email protected]>
1 parent d751162 commit 515e59a

File tree

19 files changed

+116
-77
lines changed

19 files changed

+116
-77
lines changed

template/golang-http-armhf/Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
22

3-
FROM golang:1.11-alpine3.10 as build
43

5-
ENV CGO_ENABLED=0
4+
FROM golang:1.13.1-alpine3.10 as build
5+
6+
RUN apk --no-cache add git
67

78
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
89
RUN chmod +x /usr/bin/fwatchdog
910

11+
ENV CGO_ENABLED=0
12+
1013
RUN mkdir -p /go/src/handler
1114
WORKDIR /go/src/handler
1215
COPY . .
1316

1417
# Run a gofmt and exclude all vendored code.
1518
RUN 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; }
1619

17-
RUN CGO_ENABLED=0 GOOS=linux \
18-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
19-
go test $(go list ./... | grep -v /vendor/) -cover
20+
ARG GO111MODULE="off"
21+
ARG GOPROXY=""
22+
23+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
24+
RUN go test handler/function/... -cover
2025

2126
FROM alpine:3.10
2227
# Add non root user and certs

template/golang-http-armhf/Gopkg.lock

-15
This file was deleted.

template/golang-http-armhf/go.mod

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module handler
2+
3+
go 1.12
4+
5+
replace handler/function => ./function
6+
7+
require github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921

template/golang-http-armhf/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921 h1:IGP0tlTdv6r/zy3Kw61EhiXao61krCUs5KRHWSzCdxM=
2+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921/go.mod h1:F37Kp+hwdHP+o3UKjkGzikQg4weKiMvcegT9vCQjvjE=

template/golang-http-armhf/vendor/github.com/openfaas-incubator/go-function-sdk/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/golang-http-armhf/vendor/github.com/openfaas-incubator/go-function-sdk/README.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921
2+
github.com/openfaas-incubator/go-function-sdk

template/golang-http/Dockerfile

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
22

3-
FROM golang:1.10.4-alpine3.8 as build
3+
FROM golang:1.13.1-alpine3.10 as build
4+
5+
RUN apk --no-cache add git
46

57
ENV CGO_ENABLED=0
68

79
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
810
RUN chmod +x /usr/bin/fwatchdog
911

12+
ENV CGO_ENABLED=0
13+
1014
RUN mkdir -p /go/src/handler
1115
WORKDIR /go/src/handler
1216
COPY . .
1317

1418
# Run a gofmt and exclude all vendored code.
1519
RUN 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; }
1620

17-
RUN CGO_ENABLED=0 GOOS=linux \
18-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
19-
go test $(go list ./... | grep -v /vendor/) -cover
21+
ARG GO111MODULE="off"
22+
ARG GOPROXY=""
23+
24+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
25+
RUN go test handler/function/... -cover
2026

2127
FROM alpine:3.10
2228
# Add non root user and certs

template/golang-http/Gopkg.lock

-15
This file was deleted.

template/golang-http/Gopkg.toml

-26
This file was deleted.

template/golang-http/go.mod

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module handler
2+
3+
go 1.12
4+
5+
replace handler/function => ./function
6+
7+
require github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921

template/golang-http/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921 h1:IGP0tlTdv6r/zy3Kw61EhiXao61krCUs5KRHWSzCdxM=
2+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921/go.mod h1:F37Kp+hwdHP+o3UKjkGzikQg4weKiMvcegT9vCQjvjE=

template/golang-http/vendor/github.com/openfaas-incubator/go-function-sdk/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/golang-http/vendor/github.com/openfaas-incubator/go-function-sdk/README.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921
2+
github.com/openfaas-incubator/go-function-sdk

template/golang-middleware-armhf/Dockerfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
2+
FROM golang:1.13.1-alpine3.10 as build
23

3-
4-
FROM golang:1.11-alpine3.10 as build
5-
6-
ENV CGO_ENABLED=0
4+
RUN apk --no-cache add git
75

86
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
97
RUN chmod +x /usr/bin/fwatchdog
108

9+
ENV CGO_ENABLED=0
10+
1111
RUN mkdir -p /go/src/handler
1212
WORKDIR /go/src/handler
1313
COPY . .
1414

1515
# Run a gofmt and exclude all vendored code.
1616
RUN 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; }
1717

18-
RUN CGO_ENABLED=0 GOOS=linux \
19-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
20-
go test $(go list ./... | grep -v /vendor/) -cover
18+
ARG GO111MODULE="off"
19+
ARG GOPROXY=""
20+
21+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
22+
RUN go test handler/function/... -cover
2123

2224
FROM alpine:3.10
2325
# Add non root user and certs
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module handler
2+
3+
go 1.12
4+
5+
replace handler/function => ./function

template/golang-middleware/Dockerfile

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
22

3-
FROM golang:1.11-alpine3.10 as build
3+
FROM golang:1.13.1-alpine3.10 as build
44

5-
ENV CGO_ENABLED=0
5+
RUN apk --no-cache add git
66

77
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
88
RUN chmod +x /usr/bin/fwatchdog
99

10+
ENV CGO_ENABLED=0
11+
1012
RUN mkdir -p /go/src/handler
1113
WORKDIR /go/src/handler
1214
COPY . .
1315

1416
# Run a gofmt and exclude all vendored code.
1517
RUN 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; }
1618

17-
RUN CGO_ENABLED=0 GOOS=linux \
18-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
19-
go test $(go list ./... | grep -v /vendor/) -cover
19+
ARG GO111MODULE="off"
20+
ARG GOPROXY=""
21+
22+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
23+
RUN go test handler/function/... -cover
2024

2125
FROM alpine:3.10
2226
# Add non root user and certs

template/golang-middleware/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module handler
2+
3+
go 1.12
4+
5+
replace handler/function => ./function

0 commit comments

Comments
 (0)