What is the syntax for copying a go binary built b...
# general
f
What is the syntax for copying a go binary built by pants package into a Dockerfile built by pants package?
Copy code
% ls dist/cmd.hello-world/bin
dist/cmd.hello-world/bin

% pants filter --target-type=go_binary ::
cmd/hello-world:bin

# From the Dockerfile
...
COPY cmd.hello-world/bin /go/bin/hello-world

# Build docker image
pants package cmd/hello-world:docker
...
 > [2/4] COPY cmd.hello-world/bin /go/bin/hello-world:
------
failed to compute cache key: "/cmd.hello-world/bin" not found: not found
h
Need
bin.pex
I think
So
cmd.hello-world/bin.pex
f
how does a pex (python executable) relate to golang?
h
Oh
my b. I missed the go part
It doesn't
f
np. any go fans out there who got pants working with docker builds?
h
I'm hoping to do this soon so I'm interested in knowing what you find.
b
@fast-nail-55400 or @curved-television-6568 might have a suggestion.
f
Copy code
go_binary(
    name="bin",
)
docker_image(
    name="docker",
    dependencies=[
        ":bin",
    ],
)
b
docker_image
supports
dependencies
with anything `package`able
It also supports dependency inference on those `package`able things with an
output_path
And, your best debugging tool is always running pants with
--no-process-cleanup
and poking around the relevant sandbox 🙂
h
Good question, yeah, I'm pretty sure the targets as you have them will cause the binary to be copied into the sandbox, and the question is just to figure out its path (which of course should be derivable from the information at hand, I just don't know the derivation). So as Joshua suggests, finding the binary in the sandbox in this one case should help figure it out in this and presumably future cases, as I'm assuming the path will be some obvious function of the path and target namee
c
The contents of the build context should be presented in the logs in case of docker build issues. Is it not?