netlify / git-gateway

A Gateway to Git APIs
MIT License
404 stars 89 forks source link

fix(docker): update golang to 1.19 in dockerfile #78

Open simbas opened 1 year ago

simbas commented 1 year ago

- Summary

The golang version have been updated to 1.19 in #77 but the version used in the dockerfile have not been updated. The docker build is failing at:

ERROR [3/3] RUN useradd -m netlify && cd /go/src/github.com/netlify/git-gateway && make deps build && mv git-gateway /usr/local/bin/

with the following error:

#8 6.153 go: finding golang.org/x/lint latest
#8 6.184 go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
#8 6.440 go: extracting golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
#8 6.517 go: downloading golang.org/x/tools v0.1.12
#8 7.088 go: extracting golang.org/x/tools v0.1.12
#8 7.371 go: finding golang.org/x/tools v0.6.0
#8 7.849 go: downloading golang.org/x/tools v0.6.0
#8 8.174 go: extracting golang.org/x/tools v0.6.0
#8 8.852 # golang.org/x/tools/go/gcexportdata
#8 8.852 /go/pkg/mod/golang.org/x/tools@v0.6.0/go/gcexportdata/gcexportdata.go:97:9: undefined: io.ReadAll
#8 8.852 note: module requires Go 1.18
#8 8.869 make: *** [Makefile:13: deps] Error 2

- Test plan

After updating golang in the dockerfile, the build is successful :

[+] Building 59.7s (9/9) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                   0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/golang:1.19                                                                                                                                         1.1s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                          0.0s
 => [internal] load build context                                                                                                                                                                      0.0s
 => => transferring context: 13.41kB                                                                                                                                                                   0.0s
 => CACHED [1/3] FROM docker.io/library/golang:1.19@sha256:1a86aa60f99a253ad32ec0e8820f5813d557b1735ac5cc32e042397379d57fb2                                                                            0.0s
 => [2/3] ADD . /go/src/github.com/netlify/git-gateway                                                                                                                                                 0.1s
 => [3/3] RUN useradd -m netlify && cd /go/src/github.com/netlify/git-gateway && make deps build && mv git-gateway /usr/local/bin/                                                                    55.1s
 => exporting to image                                                                                                                                                                                 3.3s
 => => exporting layers                                                                                                                                                                                3.3s
 => => writing image sha256:08d865eec186e1f974f29d351538b434ff8f7258a967be3dbcf8ef4a6bd2cc0a                                                                                                           0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

- Description for the changelog

update the requested version of golang in dockerfile to 1.19 (from 1.13)