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

Docker build failing #210

Open
adaschevici opened this issue Jun 10, 2020 · 8 comments
Open

Docker build failing #210

adaschevici opened this issue Jun 10, 2020 · 8 comments

Comments

@adaschevici
Copy link

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.

@adaschevici
Copy link
Author

adaschevici commented Jun 10, 2020

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

@cosmos72
Copy link
Member

cosmos72 commented Jun 10, 2020

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?

@adaschevici
Copy link
Author

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

@cosmos72
Copy link
Member

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

@adaschevici
Copy link
Author

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

@cosmos72
Copy link
Member

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

@cigoic
Copy link

cigoic commented Jun 10, 2020

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

@adaschevici
Copy link
Author

awesome, thanks @cigoic that worked

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

No branches or pull requests

3 participants