vouch-proxy
vouch-proxy copied to clipboard
go 1.21 for Dockerfile builds to fix build error
from golang v1.18 --> v1.21
go.uber.org/multierr now uses atomic.Bool which requires Go 1.19
Error before bumping the version
$ ./do.sh dbuild
Sending build context to Docker daemon 7.03MB
Step 1/21 : FROM golang:1.18 AS builder
---> c37a56a6d654
...
# go.uber.org/multierr
/go/pkg/mod/go.uber.org/[email protected]/error.go:209:20: undefined: atomic.Bool
note: module requires Go 1.19
...
The command '/bin/sh -c ./do.sh gobuildstatic # see `do.sh` for vouch-proxy build details' returned a non-zero code:
Build logs after bumping the version
./do.sh dbuild
$ ./do.sh dbuild
Sending build context to Docker daemon 7.017MB
Step 1/21 : FROM golang:1.21 AS builder
1.21: Pulling from library/golang
785ef8b9b236: Already exists
5a6dad8f55ae: Already exists
bd36c7bfe5f4: Already exists
9e59e6b803ed: Already exists
9e40ac7456b5: Pull complete
8e11a6c7a2e6: Pull complete
Digest: sha256:ec457a2fcd235259273428a24e09900c496d0c52207266f96a330062a01e3622
Status: Downloaded newer image for golang:1.21
---> 3758cb2c0a6b
Step 2/21 : ARG UID=999
---> Running in 355d58ab3fdf
Removing intermediate container 355d58ab3fdf
---> 5e93827a7f11
Step 3/21 : ARG GID=999
---> Running in 70d527f032d6
Removing intermediate container 70d527f032d6
---> 51429d8c99fc
Step 4/21 : LABEL maintainer="[email protected]"
---> Running in dff9a54d4216
Removing intermediate container dff9a54d4216
---> 294d1c70a0bf
Step 5/21 : RUN mkdir -p ${GOPATH}/src/github.com/vouch/vouch-proxy
---> Running in 128cf4da5bcd
Removing intermediate container 128cf4da5bcd
---> 673cdcd25550
Step 6/21 : WORKDIR ${GOPATH}/src/github.com/vouch/vouch-proxy
---> Running in a7478714a0ac
Removing intermediate container a7478714a0ac
---> d3856b9386dc
Step 7/21 : RUN groupadd -g $GID vouch && useradd --system vouch --uid=$UID --gid=$GID
---> Running in c200e07842c2
Removing intermediate container c200e07842c2
---> bd46482550d5
Step 8/21 : COPY . .
---> db9739106d85
Step 9/21 : RUN ./do.sh goget
---> Running in 7468286f3d7f
go: downloading ...
...
Removing intermediate container f6d3b095b136
---> 2b457f077f57
Step 11/21 : RUN ./do.sh install
---> Running in b3924af25fc6
Removing intermediate container b3924af25fc6
---> b91421613c1e
Step 12/21 : FROM scratch
--->
Step 13/21 : LABEL maintainer="[email protected]"
---> Using cache
---> b2559d5cca1b
Step 14/21 : COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
---> Using cache
---> cb6c4119b715
Step 15/21 : COPY --from=builder /etc/passwd /etc/passwd
---> Using cache
---> df9d6ca3aefd
Step 16/21 : COPY --from=builder /etc/group /etc/group
---> Using cache
---> ad6fc02198c5
Step 17/21 : COPY --from=builder /go/bin/vouch-proxy /vouch-proxy
---> 9b120c3f8560
Step 18/21 : USER vouch
---> Running in 875408c9fe17
Removing intermediate container 875408c9fe17
---> d124ae3883db
Step 19/21 : EXPOSE 9090
---> Running in dfe0d48ff260
Removing intermediate container dfe0d48ff260
---> 258cbb819e9b
Step 20/21 : ENTRYPOINT ["/vouch-proxy"]
---> Running in 2ee3d732dfb8
Removing intermediate container 2ee3d732dfb8
---> c5a73ad509ab
Step 21/21 : HEALTHCHECK --interval=1m --timeout=5s CMD [ "/vouch-proxy", "-healthcheck" ]
---> Running in b7a41818bb3a
Removing intermediate container b7a41818bb3a
---> 0884dc8815bd
Successfully built 0884dc8815bd
Successfully tagged quay.io/vouch/vouch-proxy:latest
./do.sh dbuildalpine - also builds successfully.
I would change it do version 1.21 which was released just a couple days ago. This PR fixes issue #530.
you also need to update the version in the go.mod file (https://stackoverflow.com/questions/60675415/how-to-upgrade-the-go-version-in-a-go-mod)
you also need to update the version in the
go.modfile (https://stackoverflow.com/questions/60675415/how-to-upgrade-the-go-version-in-a-go-mod)
Fair point.
Given that we are updating go.mod, in addition to go mod edit -go=1.21 I will include go mod tidy.
v0.40.0 upgraded golang to 1.22