docker-makefile
docker-makefile copied to clipboard
Using ssh to access private data in builds?
Using ssh to access private data in builds does not see to work with the makefile.
I get:
=> ERROR [5/9] RUN --mount=type=ssh,required GIT_SSH_COMMAND="ssh -v" git clone --progress --verbose [email protected]:worldr/private.git /app && gi 0.1s
------
[…]
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: no SSH key "" forwarded from the client
make: *** [../make/Makefile:67: docker-build] Error 1
This is a trivial fix.
In the Makefile, replace:
docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH)
with
docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_SSH) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH)
Note the new $(DOCKER_SSH) variable. In the subdirectory Makefile that need it, set
DOCKER_SSH=--ssh default
That is it.
@mvanholsteijn Do you want me to open a PR for this or is this enough?