POC: BuildKit support
I managed to get BuildKit build to work! It is not perfect yet, but it works most of the time for me.
To do this, dockerode needs to create a gRPC server and serve over a hijacked session connection to the docker backend and attach the sessionId to the build request. Even a gRPC server without any implemented services will do, but it can also be used to return credentials to docker, which is needed when using private Images or Registries.
The are some open todos and problems:
- [ ] Small changes in docker-modem are needed: https://github.com/apocas/docker-modem/pull/173
- [x] A new release of @grpc/grpc-js is needed. The
createConnectionInjectorfeature is already in master, but not release yet (https://github.com/grpc/grpc-node/pull/2675). At the moment one has to build @grpc/grpc-js locally (that's why it's linked locally in the package.json for now) - [ ] Occasionally, without changing anything, I see one of two errors in the build log. I don't know if it's a docker problem or something is wrong in my implementation. I'm happy for any hints.
- "Error while dialing only one connection allowed"
- "http2: frame too large"
Solves #601
@apocas @grpc/grpc-js is updated now. Accepting the docker-modem PR would be in your hands. Anything unclear there?
Besides that, the random errors remain. Do you have any idea what could be wrong here? If it is a docker bug, we could still move forward here, right?
@schummar Did you happen to release this anywhere?
@schummar Did you happen to release this anywhere?
No, not yet. I've been experimenting with my own library — maybe something will come of it. Let's see.
Looking into this, this weekend.
Just needed a quick fix: https://github.com/apocas/dockerode/commit/277185b52377002f01fd868fbea340b23c95ec74#diff-b72948b87400c946b100a05748533a06bc240e7f6ba5805fb23c3d796546b788L316
Tests are passing 🎉
Published https://github.com/apocas/dockerode/releases/tag/v4.0.3