Build Docker with Go app: cannot find package

前端 未结 6 736
独厮守ぢ
独厮守ぢ 2020-12-29 08:56

I have my Dockerfile in the root of directory with src/myapp folder, myapp contains myapp.go with main package.

Dockerfi

6条回答
  •  暖寄归人
    2020-12-29 09:10

    The official docs suggests the following Dockerfile:

    FROM golang:1.8
    
    WORKDIR /go/src/app
    COPY . .
    
    RUN go get -d -v ./...
    RUN go install -v ./...
    
    CMD ["app"]
    

    Please, visit https://hub.docker.com/_/golang for more info

提交回复
热议问题