Skip to content

refactor(cd): drop the dedicated stage for the scratch image's /tmp - #475

Merged
defangdevs merged 1 commit into
mainfrom
fix/cd-tmp-simplify
Aug 22, 2026
Merged

refactor(cd): drop the dedicated stage for the scratch image's /tmp#475
defangdevs merged 1 commit into
mainfrom
fix/cd-tmp-simplify

Conversation

@defangdevs

@defangdevs defangdevs commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #474, answering @lionello's question there: no, that line is not needed.

build-base's own /tmp is empty (verified: ls -la /tmp in that stage shows nothing but . and ..), so it can be copied directly and the tmpdir stage goes away.

The -m 1777 was not doing anything either. Listing the exported image, /tmp comes out drwxr-xr-x root-owned in all three variants — the tmpdir stage as merged, a plain copy from build-base, and a copy with --chmod=1777. The CD runs as root, so the mode never mattered.

What does still matter is that the directory is copied rather than conjured by WORKDIR, which is builder-specific: BuildKit materialises it, buildah/podman does not, and the image then dies at deploy time with unable to create tmp directory for workspace: stat /tmp: no such file or directory. That part of #474 stays.

Verified by building the gcp target with podman and confirming tmp/ is present in the exported image, identical to what #474 produced.

Summary by CodeRabbit

  • Chores
    • Simplified container image setup by streamlining temporary directory handling.
    • Preserved expected temporary file access and permissions in the final image.

#474 added a `tmpdir` stage whose only job was `mkdir -m 1777 /empty-tmp`.
build-base's own /tmp is already empty, so copying that instead gets the same
result with no extra stage.

The 1777 was not doing anything either: podman reports /tmp as 755 root-owned
in the image built either way, and with COPY --chmod=1777 too. The CD runs as
root, which is why the mode never mattered.

Verified by building the gcp target with podman and listing the exported
image: `tmp/` is present, identical to the image #474 produced.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3WmpdY3zc555sNdkY9dzQ
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f69ae188-4f20-432e-832d-00e6fa2d3a52

📥 Commits

Reviewing files that changed from the base of the PR and between 72bfd43 and 9cf7c91.

📒 Files selected for processing (1)
  • Dockerfile

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The Dockerfile removes the tmpdir stage and its /empty-tmp directory. The final cd-base image now copies the existing /tmp directory from build-base.

Changes

Docker image build

Layer / File(s) Summary
Copy the existing temporary directory
Dockerfile
The Dockerfile removes the dedicated tmpdir stage and copies /tmp from build-base into the final image.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9cf7c

This change removes a redundant build stage while preserving the explicit /tmp directory needed for deployment portability; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of the dedicated /tmp build stage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@defangdevs
defangdevs merged commit 85bbe1c into main Aug 22, 2026
13 checks passed
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.

1 participant