loud-nightfall-4213
09/15/2023, 8:40 AMBinaryNotFoundError: Cannot find `unzip` on `['/bin', '/opt/homebrew/bin', '/usr/bin', '/usr/local/bin']`. Please ensure that it is installed so that Pants can download the tools Pants needs to run.
I need to build a docker image for my go app, so I defined a `environment`:
[environments-preview.names]
linux_go = "//:linux_go"
and in my root BUILD
:
docker_environment(
name="linux_go",
platform="linux_x86_64",
image="golang:1.21"
)
but when I use the environment
in my go_binary
:
go_binary(
name="bin",
environment="linux_go"
)
I get the unzip
error. I do have unzip
installed, and everything works just fine when I build by go binary without setting environment
. Is there an obvious solution I haven’t found for this? (or, maybe I just don’t understand environment
, yet?)enough-analyst-54434
09/15/2023, 12:20 PMenough-analyst-54434
09/15/2023, 12:46 PMenough-analyst-54434
09/15/2023, 12:50 PM$ docker run --rm -it golang:1.21 unzip
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "unzip": executable file not found in $PATH: unknown.
enough-analyst-54434
09/15/2023, 12:51 PMloud-nightfall-4213
09/15/2023, 4:20 PMgolang:1.21
. (preferably alpine
) But, running into newbie issues and wondering if there’s docs that can make getting started with Go + Docker easier.enough-analyst-54434
09/15/2023, 4:35 PMloud-nightfall-4213
09/15/2023, 4:49 PMloud-nightfall-4213
09/15/2023, 10:27 PMgolang:1.21
and installing unzip
(only lib that was missing):
docker_environment(
name="linux_go",
platform="linux_go",
image="golang:my-own-image-with-unzip"
)
Is there a more “pants” way of managing custom dockerfiles? That is, rather than requiring I build it locally to use (or in CI), I’d be great to just have pants view it as a dependency for docker_environment
and build it? As team member interact with our repo, I’d be great to not have them run this docker build manually (I guess I can also upload it to a registry)enough-analyst-54434
09/15/2023, 10:29 PMenough-analyst-54434
09/15/2023, 10:30 PMloud-nightfall-4213
09/15/2023, 10:38 PMdocker_environment
should depend docker
targets, what’s outlined in Use a docker_environment to build the inputs to a docker_image feels right. That said, a docker_environment
does depend on an image, so it doesn’t feel invalid to suggest.loud-nightfall-4213
09/15/2023, 10:38 PMpants.backend.shell
(or adhoc_tool
)