I'm trying to run go build hello.go
inside a dockerfile, as
FROM golang
COPY hello.go /go/src/hello.go
RUN cd src/
RUN go build hello.go
RUN ./hello
It all goes well until the go build
command, then it the following error message appears:
stat hello.go: no such file or directory
The command '/bin/sh -c go build hello.go' returned a non-zero code: 1
However, if I comment the last two commands on the dockerfile and run the created image, I can run the go build
command with no problems.
Why is this happening?