10/09/2020, 2:21 PM
Oh and you can get the parent directory of the BUILD file with my_tgt.address.spec_path. But this would assume that your target is declared as a sibling of the Dockerfile; this won’t accurately be the parent of your Dockerfile if the sources are in a sub directory. you may want to enforce that invariant by defining the method validate_resolved_files on DockerSources (Or just use os.path / path lib to get the parent)