I want to make a macro that autogenerates a `pex_b...
# general
h
I want to make a macro that autogenerates a
pex_binary
and
docker_image
target for me for the majority of simple cases where we're just doing the standard base image and copying in a pex. Any recommendations on how to autopopulate the
COPY
line of the
Dockerfile
? I'd like to avoid requiring the user to specify the full path to the module that serves as the entrypoint for the
pex_binary
, but I'm not sure there's another way.
b
Have you tried
build_file_dir()
?
h
I have not!
Is that in the docs somewhere?
b
It's a function you can use in build files, it returns a
pathlib.PurePath
to the current build file dir
Unfortunately, no not yet. It uses stuff which doesn't get auto-generated docs 😞
b
The thread at https://pantsbuild.slack.com/archives/C046T6T9U/p1668559186539269 has what we use (using
build_file_dir
)
h
Wow, I wish I had explored macros sooner! Our containerization process just got much simpler.
❤️ 1