markbates / pkger

Embed static files in Go binaries (replacement for gobuffalo/packr)
MIT License
1.19k stars 60 forks source link

Errors trying to run pkger utility in Docker container with Go 1.13 #21

Closed StevenWeathers closed 5 years ago

StevenWeathers commented 5 years ago

In effort to try out Pkger in place of Packr (v1) I came across an issue trying to get Pkger to properly pack in a docker container with go 1.13. I was able to get it working with 1.12 in Docker however it seems to work fine outside docker with go 1.13. When running the app in docker with 1.12 it also logs an error message that doesn't log when running the app outside docker.

Errors I get building docker container

Step 20/28 : RUN go install github.com/markbates/pkger/cmd/pkger
 ---> Using cache
 ---> d231094cc7a4
Step 21/28 : RUN pkger
 ---> Running in 72b571527ef9
2019/11/09 02:33:07 invalid character 'g' looking for beginning of value
go: downloading github.com/stretchr/testify v1.4.0
go: downloading gopkg.in/go-playground/assert.v1 v1.2.1
go: extracting gopkg.in/go-playground/assert.v1 v1.2.1
go: extracting github.com/stretchr/testify v1.4.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v2 v2.2.5
go: downloading github.com/davecgh/go-spew v1.1.1
go: extracting github.com/pmezard/go-difflib v1.0.0
go: extracting github.com/davecgh/go-spew v1.1.1
go: extracting gopkg.in/yaml.v2 v2.2.5
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: extracting gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/kr/pretty v0.1.0
go: extracting github.com/kr/pretty v0.1.0
go: downloading github.com/kr/text v0.1.0
go: extracting github.com/kr/text v0.1.0
2019/11/09 02:33:07 stat : no such file or directory
ERROR: Service 'thunderdome' failed to build: The command '/bin/sh -c pkger' returned a non-zero code: 1

Error logged when running the app in docker container with go 1.12

thunderdome_1  | 2019/11/09 02:37:27 &{%!w(string=go) %!w(*errors.errorString=&{executable file not found in $PATH})}: 

You can find source code for my application at https://github.com/StevenWeathers/thunderdome-planning-poker

requaos commented 5 years ago

I encountered this issue and found that if I ran go mod download before attempting pkger it would run successfully.

StevenWeathers commented 5 years ago

@requaos That solved the initial issue with Go 1.13, thanks!

Now I only get this error upon runtime, doesn't seem to affect my use case though since I'm using it to serve bundled static assets not ones from filesystem during runtime.

thunderdome_1  | 2019/11/11 01:03:02 exec: "go": executable file not found in $PATH: