feat(jig): jig deploy --image - #380
Conversation
| if source_image: | ||
| if subprocess.run(["docker", "tag", source_image, image]).returncode != 0: | ||
| raise JigError(f"Failed to retag {source_image}") | ||
| ok = subprocess.run(["docker", "push", image]).returncode == 0 |
There was a problem hiding this comment.
can you test if this works properly with zstd compressed images? docker push might recompress the image as gzip before push
There was a problem hiding this comment.
👍
Tbh, I haven't tested this at all. I wanted to make sure if we're all ok with the UX
There was a problem hiding this comment.
Fixed. However it might be bit slow because we have to write the oci layout in a tmp dir and load it back to buildkit
d599181 to
090d875
Compare
Broly Security ScanNote ✅ Clean scan Note Re-scan this PR anytime with
|
docker push through a legacy (non-containerd) image store recompresses layers as gzip, losing the zstd cold-start benefit. Instead, export the source image as an OCI layout (docker save) and rebuild it through the zstd builder with force-compression, re-encoding every layer as zstd. - extract shared _buildx_push helper (was duplicated in push and build_and_push, would have been a third copy here) - --image pushes now write the buildx metadata file, so image_with_digest works without relying on docker inspect RepoDigests - JIG_DISABLE_BUILDX keeps the plain docker tag + docker push path
| layout = Path(tmp) / "oci" | ||
| layout.mkdir() | ||
| console.print(f"Exporting {source_image}") | ||
| save = subprocess.Popen(["docker", "save", source_image], stdout=subprocess.PIPE) |
There was a problem hiding this comment.
I think docker save is the really slow one
There was a problem hiding this comment.
Just piped to untar to make it bit faster. Not sure if there any other way to get the image to buildkit context
| digest = json.loads(index.read_text())["manifests"][0]["digest"] | ||
| ctx = Path(tmp) / "ctx" | ||
| ctx.mkdir() | ||
| (ctx / "Dockerfile").write_text("FROM source-image\n") |
There was a problem hiding this comment.
I think it's sufficient to do f"FROM {source_image}" with force-compression=true
There was a problem hiding this comment.
or even
ARG SOURCE_IMAGE
FROM ${SOURCE_IMAGE}
docker buildx build \
--file Dockerfile.recompress \
--build-arg SOURCE_IMAGE=registry.example.com/team/app:gzip \
--pull \
--output type=registry,name=...:zstd,compression=zstd,compression-level=10,force-compression=true,oci-mediatypes=true \
.
There was a problem hiding this comment.
Do you mean for remote registry hosted images? I don't think you can do this with local images.
Co-authored-by: technillogue <wisepoison@gmail.com>
src/together/lib/cli/api/beta/jig/jig.pyJig.push()(line 670): addedsource_imageparam. If set with empty tag, derives tag from source image (default "latest"). Branches todocker tag+docker pushinstead of buildx.push()wrapper (line ~1190): forwardssource_image.push_cli()(line ~1458): adds--imageflag, tag default →None. Passes"latest"when no image specified,""(meaning "derive from source") when image specified without explicit tag.Usage: