Skip to content

fix(docker): use COPY --chmod to avoid duplicate layer in transcription-proxy#313

Merged
basnijholt merged 1 commit intomainfrom
fix-docker-layer
Jan 25, 2026
Merged

fix(docker): use COPY --chmod to avoid duplicate layer in transcription-proxy#313
basnijholt merged 1 commit intomainfrom
fix-docker-layer

Conversation

@basnijholt
Copy link
Owner

Summary

  • Use COPY --chmod=755 to set permissions during copy instead of running chmod -R afterward
  • Eliminates ~38MB wasted layer caused by Docker storing modified file metadata as a new layer
  • The RUN command now only sets permissions on parent directories (essentially 0B)

Problem

The previous Dockerfile created two layers for the same content:

COPY --from=builder /root/.local/share/uv/tools/agent-cli /root/.local/share/uv/tools/agent-cli
RUN chmod -R 755 /root/.local/share/uv/tools/agent-cli && ...

This caused Docker to store the directory twice because modifying file metadata creates a new layer.

Solution

COPY --from=builder --chmod=755 /root/.local/share/uv/tools/agent-cli /root/.local/share/uv/tools/agent-cli
RUN chmod 755 /root /root/.local ... && ln -s ...  # Only parent dirs

Test plan

  • Docker build succeeds
  • Verified chmod layer is now 0B via docker history
  • Pre-commit passes
  • Pytest passes (909 passed)

…on-proxy

The previous approach of running `chmod -R 755` after COPY created a
duplicate layer (~38MB) because modifying file metadata causes Docker
to store the entire directory again.

Using `COPY --chmod=755` sets permissions during the copy operation,
eliminating the wasted layer. The RUN command now only sets permissions
on parent directories (which is essentially free).
@basnijholt basnijholt merged commit eeb2f5a into main Jan 25, 2026
10 checks passed
@basnijholt basnijholt deleted the fix-docker-layer branch January 25, 2026 13:54
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