FROMcommand in Earthly has the ability to reference another target's image as its base image, like in the case below where the
+buildtarget uses the image from the
FROMalso has the ability to import targets from Earthfiles in different directories. Let's say we have a directory structure like this.
/services/service-onefrom inside the Earthfile in the root of our directory.
FROMthat there is another Earthfile in the
services/service-onedirectory and that the Earthfile contains a target called
+deps. In this case, if we were to run
+buildEarthly is smart enough to go into the subdirectory, run the
+depstarget in that Earthfile, and then use it as the base image for
./services/service-onedirectory that contains its own Earthfile. We import it and then use the
ASkeyword to give it an alias.
+buildtarget we can inherit from any target in the imported Earthfile by passing
alias+target-name. In this case the Earthfile in the service directory has a target named