Skip to content

hack: Rework+cleanup container build #1295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cgwalters
Copy link
Collaborator

Main motivation: I was looking at making more changes here

  • Use an idiom I'd like to standardize more of copy context to FROM scratch image which is then mounted and consumed in other phases by mounting. This helps avoid polluting later containers with intermediate copied files.
  • Change build.sh to handle being run from any directory
  • Drop the dev-rootfs stuff as it's weird and awkward; instead we should encourage multi-step builds deriving from this image
  • Don't make bootc.tar.zst only to immediately untar it; just use COPY from the build container
  • Use heredocs to condense multiple RUN invocations to avoid pointless small layers

@cgwalters cgwalters force-pushed the rework-containerfile branch 2 times, most recently from a5c272b to d126574 Compare May 2, 2025 18:30
@cgwalters
Copy link
Collaborator Author

ERROR Installing to filesystem: Creating ostree deployment: Pulling: Importing: Parsing layer blob sha256:0f299f3f346782473308fd887c25d99af245027c4bf8df55ddf47121b4aa2d36: error: (null): Processing tar: Failed to commit tar: ExitStatus(unix_wait_status(256))

Humm...very confused by this failure

@henrywang
Copy link
Collaborator

.git was added in gitignore, so there's an error fatal: not a git repository (or any of the parent directories): .git and when we do tar -C / --zstd -xvf /tmp/bootc.tar.zst, some of files report tar: ./usr/bin/bootc: implausibly old time stamp -9223372036854775808. That might be the root cause?

@cgwalters cgwalters force-pushed the rework-containerfile branch from d126574 to bd140c7 Compare May 14, 2025 21:51
cgwalters added 2 commits May 15, 2025 13:27
So we can use heredocs.

Signed-off-by: Colin Walters <[email protected]>
Main motivation: I was looking at making more changes here

- Use an idiom I'd like to standardize more of copy context to `FROM scratch` image
  which is then mounted and consumed in other phases by mounting. This helps
  avoid polluting later containers with intermediate copied files.
- Change `build.sh` to handle being run from any directory
- Drop the `dev-rootfs` stuff as it's weird and awkward; instead we should
  encourage multi-step builds deriving from this image
- Don't make `bootc.tar.zst` only to immediately untar it; just use `COPY`
  from the build container
- Use heredocs to condense multiple `RUN` invocations to avoid pointless
  small layers

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters force-pushed the rework-containerfile branch from bd140c7 to 009e1bf Compare May 15, 2025 17:37
@cgwalters cgwalters added triaged This looks like a valid issue area/ci Issues related to our own CI gain/low Low reward labels May 15, 2025
@cgwalters cgwalters requested a review from Copilot May 15, 2025 17:37
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reworks the container build process to standardize image preparation and improve the build caching strategy. Key changes include:

  • Standardizing the build script for execution from any directory.
  • Refactoring the Containerfile to separate context and build stages and reduce intermediate file handling.
  • Enhancing the CI workflow with updated Podman support for heredocs.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
hack/build.sh Updated to dynamically determine its directory and adjust paths accordingly.
hack/Containerfile Refactored multi-stage build with context and heredoc usage to reduce intermediate artifacts.
.github/workflows/ci.yml Added a step to update Podman and related tools for improved heredoc support in CI.
.dockerignore Updated ignore rules to manage large files and prevent cache invalidation.

@cgwalters cgwalters requested a review from henrywang May 16, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Issues related to our own CI gain/low Low reward triaged This looks like a valid issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants