Fantom-foundation / go-opera

Opera blockchain protocol secured by the Lachesis consensus algorithm
https://fantom.foundation/
GNU Lesser General Public License v3.0
283 stars 283 forks source link

Docker build using docker/Dockerfile.opera keeps failing. #449

Closed klestrong closed 1 year ago

klestrong commented 1 year ago

Describe the bug Docker build keeps failing using repo provided Dockerfile (docker/Dockerfile.opera). Application "make" was successfully executed. Just in case, I updated GO to go1.19.3. Steps are show below with relative outputs.

To Reproduce Steps to reproduce the behavior: 1. cd ~ ; git clone https://github.com/Fantom-foundation/go-opera.git && mv go-opera go-opera-v1.1.2-rc.5 && cd go-opera-v1.1.2-rc.5/ 2. ~/go-opera-v1.1.2-rc.5$ go version go version go1.19.3 linux/amd64 3. ~/go-opera-v1.1.2-rc.5$ sudo git branch * (HEAD detached at v1.1.2-rc.5) master release/1.1.2-rc.5 4. ~/go-opera-v1.1.2-rc.5$ make GIT_COMMIT=git rev-list -1 HEAD 2>/dev/null || echo ""&& \ GIT_DATE=git log -1 --date=short --pretty=format:%ct 2>/dev/null || echo ""&& \ GOPROXY="https://proxy.golang.org,direct" \ go build \ -ldflags "-s -w -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitCommit=${GIT_COMMIT} -X ``github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=${GIT_DATE}" \ -o build/opera \ ./cmd/opera 5. ~/go-opera-v1.1.2-rc.5$ docker build -f docker/Dockerfile.opera --tag go-opera:v1.1.2-rc.5 . Sending build context to Docker daemon 81.34MB Step 1/12 : FROM golang:1.17-alpine as builder ---> 011dbc9d894d Step 2/12 : RUN apk add --no-cache make gcc musl-dev linux-headers git ---> Running in 7f584232f458 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz (1/21) Upgrading musl (1.2.2-r7 -> 1.2.2-r9) (2/21) Installing libgcc (10.3.1_git20211027-r0) (3/21) Installing libstdc++ (10.3.1_git20211027-r0) (4/21) Installing binutils (2.37-r3) (5/21) Installing libgomp (10.3.1_git20211027-r0) (6/21) Installing libatomic (10.3.1_git20211027-r0) (7/21) Installing libgphobos (10.3.1_git20211027-r0) (8/21) Installing gmp (6.2.1-r1) (9/21) Installing isl22 (0.22-r0) (10/21) Installing mpfr4 (4.1.0-r0) (11/21) Installing mpc1 (1.2.1-r0) (12/21) Installing gcc (10.3.1_git20211027-r0) (13/21) Installing brotli-libs (1.0.9-r5) (14/21) Installing nghttp2-libs (1.46.0-r0) (15/21) Installing libcurl (8.0.1-r0) (16/21) Installing expat (2.5.0-r0) (17/21) Installing pcre2 (10.40-r0) (18/21) Installing git (2.34.8-r0) (19/21) Installing linux-headers (5.10.41-r0) (20/21) Installing make (4.3-r0) (21/21) Installing musl-dev (1.2.2-r9) Executing busybox-1.34.1-r3.trigger OK: 148 MiB in 35 packages Removing intermediate container 7f584232f458 ---> 75a382f64d99 Step 3/12 : WORKDIR /go/go-opera ---> Running in 244d17b2158e Removing intermediate container 244d17b2158e ---> b56a1d3ff930 Step 4/12 : COPY . . ---> efa114d00ac9 Step 5/12 : ARG GOPROXY ---> Running in ce2c8d2bd0ae Removing intermediate container ce2c8d2bd0ae ---> c60078052bb6 Step 6/12 : RUN go mod download ---> Running in 9b16d97c900a Removing intermediate container 9b16d97c900a ---> 24c72ca75e31 Step 7/12 : RUN make opera ---> Running in 245d14eeffa7 GIT_COMMIT=git rev-list -1 HEAD 2>/dev/null || echo ""&& \ GIT_DATE=git log -1 --date=short --pretty=format:%ct 2>/dev/null || echo ""` && \ GOPROXY="https://proxy.golang.org,direct" \ go build \ -ldflags "-s -w -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitCommit=${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=${GIT_DATE}" \ -o build/opera \ ./cmd/opera

github.com/Fantom-foundation/go-opera/cmd/opera/launcher/metrics

cmd/opera/launcher/metrics/metrics.go:24:11: undefined: atomic.Int64 make: *** [Makefile:7: opera] Error 2 The command '/bin/sh -c make opera' returned a non-zero code: 2` -END-OF-PROCESS-

Expected behavior The application build should end with a successful comment.

Desktop (please complete the following information):

klestrong commented 1 year ago

Here is a better illustration of the docker build failure message. image

dsloanather commented 1 year ago

Same issue

icculp commented 1 year ago

Same issue here as well

icculp commented 1 year ago

Appears they fixed it here https://github.com/Fantom-foundation/go-opera/pull/434 and is in rc6; but also you can probably update to go 1.19, trying that now myself

icculp commented 1 year ago

Confirmed working with 1.19, so just change the top line of the Dockerfile to this: FROM golang:1.19-alpine as builder

klestrong commented 1 year ago

Thank you! The build finally finished successfully.