Search papers, labs, and topics across Lattice.
This paper introduces Cadre, a context-aware framework designed to repair Dockerfile drift by leveraging a Context-aware Dependency Graph (CDG) that maps dependencies between Dockerfile instructions and their source code. By selecting contextually relevant information to generate targeted patches, Cadre achieves a 35.22% repair rate, significantly outperforming both rule-based and LLM-based baselines. The framework's two-step workflow effectively mitigates prompt-overflow issues, maintaining high performance even as drift ages across commits.
Cadre repairs Dockerfile drift with a 35.22% success rate, outperforming existing methods by leveraging context-aware dependency modeling.
Docker is widely used to create reproducible build environments, but Dockerfile drift, the divergence between a Dockerfile and its evolving source code, can cause CI/CD builds to fail. Existing rule-based and retrieval-based repair approaches analyze Dockerfiles in isolation and therefore struggle with context-dependent failures. We present Cadre, a context-aware framework for automated Dockerfile drift repair. Cadre uses static analysis to construct a Context-aware Dependency Graph (CDG), which maps each Dockerfile instruction to its file-level and inter-instruction dependencies. Guided by the CDG, Cadre first selects the context causally relevant to a failure and then generates a targeted patch from that context. We also introduce DodeX, a pipeline that mines real-world Dockerfile drift instances from GitHub Actions CI logs while preserving the complete build configurations omitted by static-snapshot datasets. Using DodeX, we construct $D^3$, a benchmark of 1,040 drift instances reproducible locally with the original CI parameters. Across $D^3$, Cadre achieves a 35.22\% repair rate, 2.78$\times$ that of the rule-based baseline and 1.24$\times$ that of the best LLM-based baseline. Its two-step workflow keeps 95.25\% of prompts below 30k tokens and avoids the prompt-overflow failures that prevent competing LLM-based methods from producing patches in 41 to 58 cases per method. Ablation results confirm that both the CDG and the two-step workflow improve repair performance. Cadre's advantage over diff-only approaches also increases as drift ages across commits, supporting explicit dependency modeling for context-aware infrastructure-as-code maintenance. Code and data are available at https://github.com/dw763j/Cadre.