I build JVM-based project and would like to have an Earthly target with integration steps similar to this one using WITH DOCKER ... END syntax.
WITH DOCKER command is needed to have a real database instance available in the context of integration tests execution.
Since I work on a JVM project, my base image for executing any commands related to build system is: FROM bellsoft/liberica-openjdk-alpine:17. The thing which I find suboptimal is that for any command running inside of WITH DOCKER ... END block Earthly check for presence of jq and docker/docker-compose projects. Each time I execute integration tests on CI node, jq and docker get installed, while they are completely useless in my WITH DOCKER usage scenario.
Is there a way to disable their installation? Right now, as a workaround, I consider adding jq and docker to my base bellsoft/liberica-openjdk-alpine:17 builder-image to make docker/jq installation *cached*
Alex Couture-Beil recently provided good answer to this question on Earthly Slack
I think that's the best way to avoid installing dependencies on each build, just use the recommended
earthly/dind:alpineforWITH DOCKERcommands, it will only be downloaded once and run tests withdocker runinstead ofRUN. Here is how I changed my pipeline now: