push: implement a simple tool in bun that serves as a workaround for request body limits #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Push chunked images to serverless-registry
This is a pretty simple tool that allows you to push docker images to serverless-registry
when the layers are too big.
How to run
Then:
How does it work
It exports the image using
docker save
, then pushes each layer to the registry.It only supports
Basic
authentication as it's the one that serverless-registry uses.It's able to chunk layers depending on the header
oci-chunk-max-length
returned by the registry when the clientcreates an upload.
Interesting output folders
.cache
..cache
. Files that end in-ptr
have a digest in the content thatrefers to another layer in the folder.
There is a few more workarounds in the code like having to use node-fetch as Bun overrides the Content-Length
header from the caller.
This pushing tool is just a workaround on the Worker limitation in request body.
Pushing locally
To push to a localhost registry you need to set the environment variable INSECURE_HTTP_PUSH=true.
Other options?
If the reader is interested, there is more options or alternatives to have a faster pushing chunk tool:
We could redesign this tool to run with the Docker overlay storage. The biggest con is having to run a
privileged docker container that uses https://github.com/justincormack/nsenter1 to access the Docker storage.
Create a localhost proxy that understands V2 registry protocol, and chunks things accordingly. The con is that
docker has issues pushing to localhost registries.
If Docker is not a hard-dependency, use podman like described in this very informative Github comment.
Improvements