GithubHelp home page GithubHelp logo

Comments (6)

jbuberel avatar jbuberel commented on August 19, 2024

For what it is worth, I have now reproduced this same error using ubuntu:latest as the base image.

The Dockerfile contents:

FROM ubuntu:latest

RUN apt-get update \
    && apt-get install -y \
       curl gcc git libc6-dev make \
       --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*


ENV GOLANG_VERSION 1.4.2
ENV PATH /go/bin:/usr/src/go/bin:$PATH
ENV GOPATH /go

RUN curl --insecure -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
    | tar -v -C /usr/src -xz
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
RUN mkdir -p /go/src/app /go/bin && chmod -R 777 /go

WORKDIR /go
ENV GIT_SSL_NO_VERIFY true
RUN go get github.com/constabulary/gb/...

COPY . /go

RUN gb build all

The error message is identical:

2015/05/01 15:13:20 INFO compile github.com/jbuberel/prime_finder/app [server.go]
2015/05/01 15:13:20 command "build" failed: run: [/usr/lib/google-golang/pkg/tool/linux_amd64/6g -p github.com/constabulary/gb/cmd/gb -pack -o /tmp/gb261408936/github.com/constabulary/gb/cmd/gb/main.a -I /tmp/gb261408936 -I /go/pkg/linux/amd64 -complete build.go main.go plugin.go test.go]: [/usr/lib/google-golang/pkg/tool/linux_amd64/6g -p github.com/constabulary/gb/cmd/gb -pack -o /tmp/gb261408936/github.com/constabulary/gb/cmd/gb/main.a -I /tmp/gb261408936 -I /go/pkg/linux/amd64 -complete build.go main.go plugin.go test.go]: fork/exec /usr/lib/google-golang/pkg/tool/linux_amd64/6g: no such file or directory
2015/05/01 15:13:20 INFO build duration: 10.005319ms map[compile:4.017273ms]

from gb.

jbuberel avatar jbuberel commented on August 19, 2024

Possibly related to: moby/moby#8539

from gb.

jbuberel avatar jbuberel commented on August 19, 2024

Interesting - setting the GOBIN environment variable inside the Docker image seems to have resolved the problem. I am going to next verify this against the google/golang docker base image.

FROM ubuntu:latest

RUN apt-get update \
    && apt-get install -y \
       curl gcc git libc6-dev make \
       --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*


ENV GOLANG_VERSION 1.4.2
ENV PATH /go/bin:/usr/src/go/bin:$PATH
ENV GOPATH /go

RUN mkdir -p /gosrc

RUN curl --insecure -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
    | tar -v -C /gosrc -xz
RUN cd /gosrc/go/src && ./make.bash --no-clean 2>&1
RUN mkdir -p /go/ /go/bin && chmod -R 777 /go

ENV GOBIN /gosrc/go/bin
ENV PATH  /gosrc/go/bin:$PATH

WORKDIR /go
ENV GIT_SSL_NO_VERIFY true
RUN go get github.com/constabulary/gb/...

COPY . /go

RUN gb build all

from gb.

jbuberel avatar jbuberel commented on August 19, 2024

Confirmed, the problem seems to be solvable by specifically setting the GOBIN environment variable to ensure it points to the same location where the go command was installed into.

Is this worth mentioning in the docs?

from gb.

davecheney avatar davecheney commented on August 19, 2024

from gb.

jbuberel avatar jbuberel commented on August 19, 2024

After grabbing the latest gb snapshot, the problem is now resolved by using the -goroot as you suggested.

The final, working, Dockerfile is this:

FROM gcr.io/google_appengine/base

RUN apt-get update \
    && apt-get install -y \
       curl gcc git libc6-dev make \
       --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

ENV GOLANG_VERSION 1.4.2
ENV PATH /go/bin:/gosrc/go/bin:$PATH
ENV GOPATH /go

RUN mkdir -p /gosrc

RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
    | tar -v -C /gosrc -xz
RUN cd /gosrc/go/src && ./make.bash --no-clean 2>&1
RUN mkdir -p /go/ /go/bin && chmod -R 777 /go

WORKDIR /go

COPY . /go
RUN rm -rf src/github.com/constabulary/
RUN rm -rf vendor/src/github.com/constabulary/

RUN go get github.com/constabulary/gb/...

RUN ["/go/bin/gb", "build", "-goroot=/gosrc/go", "all" ]

ENTRYPOINT ["/go/bin/app"]

from gb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.