Awesome thanks

On Wednesday, September 19, 2018 at 10:40:30 PM UTC+3, Justin Israel wrote:
>
>
>
> On Thu, Sep 20, 2018, 6:09 AM Sotirios Mantziaris <smant...@gmail.com 
> <javascript:>> wrote:
>
>> hi,
>>
>> i am trying to build a container that supports modules and i get the 
>> following error:
>>
>> ↳ docker build . -t test                                                  
>>                                                                             
>>                                                                      1 ↵  
>> 4.91G RAM  0.00K SWP  21:04:00
>> Sending build context to Docker daemon  16.65MB
>> Step 1/6 : FROM golang:latest as builder
>>  ---> fb7a47d8605b
>> Step 2/6 : COPY . ./
>>  ---> Using cache
>>  ---> 95a6b0284991
>> Step 3/6 : RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o 
>> test ./cmd/test/main.go
>>  ---> Running in f09b924aa3e9
>> $GOPATH/go.mod exists but should not
>> The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux go build -a 
>> -installsuffix cgo -o test ./cmd/test/main.go' returned a non-zero code: 1
>>
>> The docker file looks like this.
>>
>> FROM golang:latest as builder
>> COPY . ./
>> RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o test 
>> ./cmd/test/main.go 
>>
>> FROM scratch
>> COPY --from=builder test .
>> CMD ["./test"]
>>
>> any ideas how to solve this?
>>
>
> The golang image sets WORKDIR $GOPATH, and you don't modify it at all. So 
> you are copying your project files to $GOPATH
>
> Try doing 
>
> WORKDIR $GOPATH/src/myapp
>
> Or to some location outside $GOPATH
>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to