Skip to content

dockerfile: download frozen images with skopeo#50659

Closed
crazy-max wants to merge 2 commits intomoby:masterfrom
crazy-max:frozen-with-scopeo
Closed

dockerfile: download frozen images with skopeo#50659
crazy-max wants to merge 2 commits intomoby:masterfrom
crazy-max:frozen-with-scopeo

Conversation

@crazy-max
Copy link
Copy Markdown
Member

@crazy-max crazy-max commented Aug 7, 2025

relates to #50655
follow-up #44005

Dockerfile Outdated
Comment on lines +121 to +130
RUN --mount=from=skopeo,source=/out/skopeo,target=/usr/bin/skopeo <<EOT
set -ex
mkdir /out
skopeo --insecure-policy copy docker://busybox@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 --additional-tag busybox:latest docker-archive:///out/busybox-latest.tar
skopeo --insecure-policy copy docker://busybox@sha256:1f81263701cddf6402afe9f33fca0266d9fff379e59b1748f33d3072da71ee85 --additional-tag busybox:glibc docker-archive:///out/busybox-glibc.tar
skopeo --insecure-policy copy docker://debian@sha256:2bc5c236e9b262645a323e9088dfa3bb1ecb16cc75811daf40a23a824d665be9 --additional-tag debian:bookworm-slim docker-archive:///out/debian-bookworm-slim.tar
skopeo --insecure-policy copy docker://hello-world@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9 --additional-tag hello-world:latest docker-archive:///out/hello-world-latest.tar
skopeo --insecure-policy --override-os linux --override-arch arm --override-variant v7 copy docker://arm32v7/hello-world@sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1 --additional-tag arm32v7/hello-world:latest docker-archive:///out/arm32v7-hello-world-latest.tar
skopeo --insecure-policy --override-os linux --override-arch amd64 copy docker://hello-world@sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 --additional-tag hello-world:amd64 docker-archive:///out/hello-world-amd64.tar
skopeo --insecure-policy --override-os linux --override-arch arm64 copy docker://hello-world@sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343 --additional-tag hello-world:arm64 docker-archive:///out/hello-world-arm64.tar
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that will no longer be read correctly by

func readFrozenImageList(ctx context.Context, dockerfilePath string, images []string) (map[string]string, error) {
f, err := os.Open(dockerfilePath)
if err != nil {
return nil, errors.Wrap(err, "error reading dockerfile")
}
defer f.Close()
ls := make(map[string]string)
span := trace.SpanFromContext(ctx)
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := strings.Fields(scanner.Text())
if len(line) < 3 {
continue
}
if line[0] != "RUN" || line[1] != "./contrib/download-frozen-image-v2.sh" {
continue
}
for scanner.Scan() {
img := strings.TrimSpace(scanner.Text())
img = strings.TrimSuffix(img, "\\")
img = strings.TrimSpace(img)
split := strings.Split(img, "@")
if len(split) < 2 {
break
}
for _, i := range images {
if split[0] == i {
ls[i] = img
if span.IsRecording() {
span.AddEvent("found frozen image", trace.WithAttributes(attribute.String("image", i)))
}
break
}
}
}
}
return ls, nil
}

(yes it's really cursed code 🙈)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh didn't catch this one indeed

Copy link
Copy Markdown
Member Author

@crazy-max crazy-max Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done it the lazy way by removing lazy pull. I think this is fine as we always assume we run integration tests in our sandbox.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we continue using /build/ (to stay consistent)?

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max force-pushed the frozen-with-scopeo branch from b79e98c to e168f2f Compare August 7, 2025 18:15
@thaJeztah thaJeztah marked this pull request as ready for review August 7, 2025 18:27
@thaJeztah
Copy link
Copy Markdown
Member

Discussing possibly use crane for this (or regctl).

@crazy-max crazy-max closed this Aug 7, 2025
@crazy-max crazy-max deleted the frozen-with-scopeo branch August 7, 2025 18:43
@thaJeztah thaJeztah changed the title dockerfile: download frozen images with scopeo dockerfile: download frozen images with skopeo Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants