gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker build failing

adaschevici opened this issue · comments

I have tried to build the Docker image locally both using Dockerfile and Dockerfile.DS but it seems to fail.

The build of gophernotes is failing on the go build command.
I tried changing the go interpreter to a previous version but got this:

go: downloading golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375
go: downloading github.com/mattn/go-runewidth v0.0.9
# github.com/cosmos72/gomacro/xreflect
/go/pkg/mod/github.com/cosmos72/gomacro@v0.0.0-20200607151955-647446f8352c/xreflect/value.go:214:16: v.fwd().IsZero undefined (type reflect.Value has no field or method IsZero)

without changing anything the error I am getting is this:

/usr/lib/go/src/internal/reflectlite/value.go:8:2: found packages runtime (alg.go) and trace (annotation.go) in /usr/lib/go/src/runtime
package github.com/gopherdata/gophernotes
        imports github.com/cosmos72/gomacro/ast2
        imports github.com/cosmos72/gomacro/go/etoken
        imports github.com/cosmos72/gomacro/imports
        imports plugin
        imports runtime/cgo: no Go files in /usr/lib/go/src/runtime/cgo
/go/pkg/mod/github.com/cosmos72/gomacro@v0.0.0-20200607151955-647446f8352c/imports/runtime_debug.go:8:2: no Go files in /usr/lib/go/src/runtime/debug
/go/pkg/mod/github.com/cosmos72/gomacro@v0.0.0-20200607151955-647446f8352c/imports/go1_11/runtime_trace.go:10:2: no Go files in /usr/lib/go/src/runtime/trace
/usr/lib/go/src/crypto/x509/x509.go:37:2: found packages asn1 (asn1.go) and cryptobyte (builder.go) in /usr/lib/go/src/vendor/golang.org/x/crypto/cryptobyte
/usr/lib/go/src/crypto/x509/x509.go:38:2: no Go files in /usr/lib/go/src/vendor/golang.org/x/crypto/cryptobyte/asn1

Tried building the image using docker on OSX and ubuntu.

The image built on DockerHub works, but i am not sure what I missed while building it locally, shouldn't it just work?

I recently had to make incompatible changes to the go interpreter, with corresponding changes to gophernotes - thus you cannot just mix arbitrary versions: each go.mod contains the correct dependencies.

Actually, the main issue is

/usr/lib/go/src/internal/reflectlite/value.go:8:2: found packages runtime (alg.go) and trace (annotation.go) in /usr/lib/go/src/runtime

which points to the possible reason:
maybe a new version of Go toolchain was installed in /usr/lib/go on top of an older one, without removing the latter first?

Perhaps I did not fully understand what you mean.

What i did:

  1. cloned the repo
  2. ran docker build . and docker build --file Dockerfile.DS

Regarding having an earlier go version:

I inserted RUN go -version prior to the command and it looked like go isn't installed

Yes, the docker builds create an environment from scratch.

What I meant is that maybe the Dockerfile.DS somehow manages to install Go toolchain twice in the same location, which causes the error you reported

what i can make out from the Dockerfile is this line adding go

    && apk --update-cache --allow-untrusted \
        --repository http://dl-4.alpinelinux.org/alpine/edge/community \
        --arch=x86_64 add \
        go \

but i can't tell if the following lines are adding go, they don't seem to be adding another toolchain

I can't tell either... not a Docker expert at all.
Maybe @SpencerPark can help?

Using Alpine 3.10 should work fine with its latest version of Go (1.14.3-r1).

  • Python 3.7.x
  • pip 19.2.3

Please update the Dockerfile.DS with the following codes:

@line 1
FROM alpine:3.10

@line 12, 13
--repository http://dl-4.alpinelinux.org/alpine/v3.10/community \
--repository http://dl-4.alpinelinux.org/alpine/v3.10/main \

@line 25, 26
&& pip3 install --upgrade pip==19.2.3 \
&& ln -s /usr/bin/python3.7 /usr/bin/python \

@line 36
&& pip3 install jupyter notebook pyzmq tornado ipykernel \

@line 67
&& find /usr/lib/python3.7 -name __pycache__ | xargs rm -r \

  • Build the docker image
    docker build --tag test:nb --file Dockerfile.DS .

  • You could just refer to my revised Dockerfile.DS:
    Dockerfile.txt

awesome, thanks @cigoic that worked