---
title: "adam bien's blog"
url: https://daily.dev/posts/adam-bien-s-blog-0nd2pyi2a
source_url: https://adambien.blog/roller/abien/entry/multi_stage_docker_builds_are_an_antipattern_in_most_java_pr
type: article
source: "Adam Bien"
published: 2026-08-18T13:20:11.239Z
updated: 2026-08-18T14:05:34.200Z
tags: ["java", "architecture", "docker", "cicd", "maven"]
reading_time: 2
upvotes: 2
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# adam bien's blog

**[Adam Bien](https://daily.dev/sources/adam-bien)** · 2 min read · 2 upvotes · 1 comments

## Summary

Multi-stage Docker builds are criticized as an antipattern for Java shops that already have a Maven or Gradle CI/CD pipeline compiling, testing, and versioning artifacts. Rebuilding inside Docker means the image no longer contains the exact artifact that passed the pipeline's tests, just a similar rebuild sharing the same commit. The recommended alternative is a single-stage Dockerfile that copies the already-built jar into a minimal runtime image (e.g. eclipse-temurin:25-jre-alpine), reserving multi-stage builds for cases where Docker itself is the chosen build environment.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://adambien.blog/roller/abien/entry/multi_stage_docker_builds_are_an_antipattern_in_most_java_pr>

## Questions this post answers

### Should I use a multi-stage Dockerfile for a Java app that already has a Maven or Gradle CI/CD pipeline?

No, a single-stage Dockerfile is preferable when a CI/CD pipeline already compiles, tests, and versions the artifact. Multi-stage builds recompile the code inside Docker with a different JDK, local repository, and cache, producing a rebuild rather than packaging the exact tested artifact. The better approach copies the already-built jar into a minimal runtime image, such as eclipse-temurin:25-jre-alpine.

_daily.dev surfaces practical takes like this for teams weighing Docker build strategies in Java pipelines._

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 0 upvotes

> I think CI should promote the exact artifact it tested into the runtime image

## Similar posts on daily.dev

- [Docker Multistage Builds: How to Optimize Your Images](https://daily.dev/posts/docker-multistage-builds-how-to-optimize-your-images-4apfwsakv) · Spacelift · 16 upvotes · 1 comments
- [Why To Use A Multi-Stage Dockerfile](https://daily.dev/posts/why-to-use-a-multi-stage-dockerfile-ripe33vzt) · RUBYLAND · 0 upvotes · 0 comments
- [Building the Perfect Docker Image for a Java app](https://daily.dev/posts/building-the-perfect-docker-image-for-a-java-app-wf0dbjzj1) · Vaadin · 1 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#architecture](https://daily.dev/tags/architecture), [#docker](https://daily.dev/tags/docker), [#cicd](https://daily.dev/tags/cicd), [#maven](https://daily.dev/tags/maven)

[View this post on daily.dev](https://daily.dev/posts/adam-bien-s-blog-0nd2pyi2a)
