I received a project that is built with a number of Makefile
s which run a number of docker
commands. I want to build it on Cloud Build.
I know that Cloud Build handles Docker natively, but must work with the existing Makefile-structure.
I tried the make Custom Build step, but Cloud Build failed on lack of docker
and kubectl
. So I could add these to the Dockerfile
of the make Custom Build step, but it seems like that is wrong, because then make runs Docker-in-Docker and this causes problems -- for example, gcloud
and kubectl
permissions and context are missing.
As a small part of one such a Makefile, here is a target that calls docker build
and docker push
.
build/myapp/deployer: ...
docker build \
--build-arg REGISTRY="$(REGISTRY)/myapp" \
--tag "$(APP_DEPLOYER_IMAGE)" \
-f deployer/Dockerfile \
.
docker push "$(APP_DEPLOYER_IMAGE)"
@touch "$@"
How do I run these Makefiles in Cloud Build?