chainguard-dev / chainguard-dev/dfc

Comment stripped from within RUN statement

Open
#32 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
103
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I wanted to put dfc through it's paces by pointing it at the most convoluted Dockerfile I knew of: https://raw.githubusercontent.com/kubernetes/minikube/refs/heads/master/deploy/kicbase/Dockerfile

When I went to diff the result, I was surprised to see that it preserved most comments, but stripped a comment out in the middle of a RUN line:

--- Dockerfile.txt      2025-03-19 08:22:38
+++ Containerfile       2025-03-19 08:25:32
@@ -21,7 +21,7 @@
 # this ARG needs to be global to use it in `FROM` & is updated for new versions of ubuntu:jammy-*
 ARG UBUNTU_JAMMY_IMAGE="ubuntu:jammy-20250126"
 # multi-stage docker build so we can build auto-pause for arm64
-FROM golang:1.24.0 as auto-pause
+FROM cgr.dev/ORG/golang:1.24.0-dev AS auto-pause
 WORKDIR /src
 # auto-pause depends on core minikube code so we need to pass the whole source code as the context
 # copy in the minimal amount of source code possible
@@ -137,7 +137,6 @@
     sudo \
     openssh-server \
     dnsutils \
-    # libglib2.0-0 is required for conmon, which is required for podman
     libglib2.0-0

I realize this is an esoteric use case but figured I should report it nonetheless. Awesome work!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report using the linked minikube Dockerfile and compare dfc's output around the commented package line. Trace the Dockerfile conversion path that handles comments inside RUN instructions, then verify that the inline comment is preserved while the rest of the conversion remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.