Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golang image version to 1.15-apline3.12 #53

Merged
merged 1 commit into from Jan 3, 2021

Conversation

viveksyngh
Copy link
Contributor

@viveksyngh viveksyngh commented Jan 3, 2021

Signed-off-by: Vivek Singh vivekkmr45@yahoo.in

Description

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • read the CONTRIBUTION guide
  • signed-off my commits with git commit -s
  • added unit tests

@viveksyngh viveksyngh changed the title Bump golang image version to 1.13-apline3.12 Bump golang image version to 1.15-apline3.12 Jan 3, 2021
@alexellis
Copy link
Member

alexellis commented Jan 3, 2021

Can you do a test function with and without Go modules please for the Golang-http template?

When doing the test with modules, use the GO111MODULE build-arg as per the docs/README.

@viveksyngh
Copy link
Contributor Author

I tested with both option, seems to be working fine.

faas-cli build -f test-fn.yml
[0] > Building test-fn.
Clearing temporary build folder: ./build/test-fn/
Preparing: ./test-fn/ build/test-fn/function
Building: test-fn:latest with golang-http template. Please wait..
Sending build context to Docker daemon  22.53kB
Step 1/30 : FROM --platform=${TARGETPLATFORM:-linux/amd64} openfaas/of-watchdog:0.8.0 as watchdog
 ---> 1ebcac6b156c
Step 2/30 : FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.15-alpine3.12 as build
 ---> 1463476d8605
Step 3/30 : ARG TARGETPLATFORM
 ---> Using cache
 ---> 1947581f1f6b
Step 4/30 : ARG BUILDPLATFORM
 ---> Using cache
 ---> 5e1e191e6afc
Step 5/30 : ARG TARGETOS
 ---> Using cache
 ---> afccbd60c067
Step 6/30 : ARG TARGETARCH
 ---> Using cache
 ---> ef04d8f35d1c
Step 7/30 : RUN apk --no-cache add git
 ---> Using cache
 ---> f3543555cef9
Step 8/30 : ENV CGO_ENABLED=0
 ---> Using cache
 ---> a2d32d9b350d
Step 9/30 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
 ---> Using cache
 ---> 8dd01769b56b
Step 10/30 : RUN chmod +x /usr/bin/fwatchdog
 ---> Using cache
 ---> 38e96841cfb6
Step 11/30 : RUN mkdir -p /go/src/handler
 ---> Using cache
 ---> 815be8d709b0
Step 12/30 : WORKDIR /go/src/handler
 ---> Using cache
 ---> 24426d5e0868
Step 13/30 : COPY . .
 ---> Using cache
 ---> f552b1e62eea
Step 14/30 : 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; }
 ---> Using cache
 ---> 2bc22671afcc
Step 15/30 : ARG GO111MODULE="off"
 ---> Using cache
 ---> 2e9d1da72f71
Step 16/30 : ARG GOPROXY=""
 ---> Using cache
 ---> 772dd304c811
Step 17/30 : RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH}     go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
 ---> Using cache
 ---> 16cc9b6a20e1
Step 18/30 : RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test handler/function/... -cover
 ---> Using cache
 ---> 00cb686f2827
Step 19/30 : FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.12
 ---> 389fef711851
Step 20/30 : RUN apk --no-cache add ca-certificates     && addgroup -S app && adduser -S -g app app     && mkdir -p /home/app     && chown app /home/app
 ---> Using cache
 ---> 3ea89878a54c
Step 21/30 : WORKDIR /home/app
 ---> Using cache
 ---> d1b26d8886b9
Step 22/30 : COPY --from=build /go/src/handler/handler    .
 ---> Using cache
 ---> 9f6a04c199f5
Step 23/30 : COPY --from=build /usr/bin/fwatchdog         .
 ---> Using cache
 ---> 3814e442163c
Step 24/30 : COPY --from=build /go/src/handler/function/  .
 ---> Using cache
 ---> 3a28600f9612
Step 25/30 : RUN chown -R app /home/app
 ---> Using cache
 ---> 6cbf2bf5455c
Step 26/30 : USER app
 ---> Using cache
 ---> b3f0d3d8dda2
Step 27/30 : ENV fprocess="./handler"
 ---> Using cache
 ---> ecd4d0344a2a
Step 28/30 : ENV mode="http"
 ---> Using cache
 ---> 0145979076e0
Step 29/30 : ENV upstream_url="http://127.0.0.1:8082"
 ---> Using cache
 ---> 5d125d71e928
Step 30/30 : CMD ["./fwatchdog"]
 ---> Using cache
 ---> 7235ea14508e
Successfully built 7235ea14508e
Successfully tagged test-fn:latest
Image: test-fn:latest built.
[0] < Building test-fn done in 0.27s.
[0] Worker done.

Total build time: 0.27s
(⎈ |N/A:N/A)➜  golang-http-template git:(master) ✗ faas-cli build
(⎈ |N/A:N/A)➜  golang-http-template git:(master) ✗ faas-cli build -f test-fn.yml --build-arg GO111MODULE=on
[0] > Building test-fn.
Clearing temporary build folder: ./build/test-fn/
Preparing: ./test-fn/ build/test-fn/function
Building: test-fn:latest with golang-http template. Please wait..
Sending build context to Docker daemon  22.53kB
Step 1/30 : FROM --platform=${TARGETPLATFORM:-linux/amd64} openfaas/of-watchdog:0.8.0 as watchdog
 ---> 1ebcac6b156c
Step 2/30 : FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.15-alpine3.12 as build
 ---> 1463476d8605
Step 3/30 : ARG TARGETPLATFORM
 ---> Using cache
 ---> 1947581f1f6b
Step 4/30 : ARG BUILDPLATFORM
 ---> Using cache
 ---> 5e1e191e6afc
Step 5/30 : ARG TARGETOS
 ---> Using cache
 ---> afccbd60c067
Step 6/30 : ARG TARGETARCH
 ---> Using cache
 ---> ef04d8f35d1c
Step 7/30 : RUN apk --no-cache add git
 ---> Using cache
 ---> f3543555cef9
Step 8/30 : ENV CGO_ENABLED=0
 ---> Using cache
 ---> a2d32d9b350d
Step 9/30 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
 ---> Using cache
 ---> 8dd01769b56b
Step 10/30 : RUN chmod +x /usr/bin/fwatchdog
 ---> Using cache
 ---> 38e96841cfb6
Step 11/30 : RUN mkdir -p /go/src/handler
 ---> Using cache
 ---> 815be8d709b0
Step 12/30 : WORKDIR /go/src/handler
 ---> Using cache
 ---> 24426d5e0868
Step 13/30 : COPY . .
 ---> Using cache
 ---> f552b1e62eea
Step 14/30 : 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; }
 ---> Using cache
 ---> 2bc22671afcc
Step 15/30 : ARG GO111MODULE="off"
 ---> Using cache
 ---> 2e9d1da72f71
Step 16/30 : ARG GOPROXY=""
 ---> Using cache
 ---> 772dd304c811
Step 17/30 : RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH}     go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
 ---> Using cache
 ---> 788c1894e629
Step 18/30 : RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test handler/function/... -cover
 ---> Using cache
 ---> 83a13069e60b
Step 19/30 : FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.12
 ---> 389fef711851
Step 20/30 : RUN apk --no-cache add ca-certificates     && addgroup -S app && adduser -S -g app app     && mkdir -p /home/app     && chown app /home/app
 ---> Using cache
 ---> 3ea89878a54c
Step 21/30 : WORKDIR /home/app
 ---> Using cache
 ---> d1b26d8886b9
Step 22/30 : COPY --from=build /go/src/handler/handler    .
 ---> Using cache
 ---> 93775af541a3
Step 23/30 : COPY --from=build /usr/bin/fwatchdog         .
 ---> Using cache
 ---> 6d3cc50c255c
Step 24/30 : COPY --from=build /go/src/handler/function/  .
 ---> Using cache
 ---> 46672335bf46
Step 25/30 : RUN chown -R app /home/app
 ---> Using cache
 ---> 91179d3a4d56
Step 26/30 : USER app
 ---> Using cache
 ---> 1b9c929d127d
Step 27/30 : ENV fprocess="./handler"
 ---> Using cache
 ---> ea7b9bf12a49
Step 28/30 : ENV mode="http"
 ---> Using cache
 ---> 2f92ee4f8db8
Step 29/30 : ENV upstream_url="http://127.0.0.1:8082"
 ---> Using cache
 ---> 282bf1401640
Step 30/30 : CMD ["./fwatchdog"]
 ---> Using cache
 ---> 0a00df0c0ae2
Successfully built 0a00df0c0ae2
Successfully tagged test-fn:latest
Image: test-fn:latest built.
[0] < Building test-fn done in 0.26s.
[0] Worker done.

Total build time: 0.26s

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexellis alexellis merged commit b2dfa2c into openfaas:master Jan 3, 2021
@alexellis
Copy link
Member

Anyone who needs Go 1.13, can use this release made prior to the merge: https://github.com/openfaas/golang-http-template/releases/tag/0.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants