Build and packaging are verifiable results
A Dockerfile, packaging script, or Gradle task describes intent. It becomes useful evidence only after an actual build, start, and smoke check in an environment close to a clean runner.
Treat packaging as a set: build files, Dockerfile, Compose or start command, README, and EVIDENCE_LOG.md.
| Artifact | What it can establish |
|---|---|
| Dockerfile | How the runtime image is created |
| Compose or run script | How the service starts and receives configuration |
| README.md | How another person repeats build and start |
| EVIDENCE_LOG.md | Which commands, results, and smoke signals actually ran |
Multi-stage builds and actual paths
This is a schema, not a ready Dockerfile for every project. Verify image names, base versions, and JAR paths against build.gradle, the bootJar output, and build/libs. Do not assume that every artifact is named app.jar.
FROM gradle:latest AS build
WORKDIR /workspace
COPY . .
RUN ./gradlew bootJar
FROM eclipse-temurin:latest
COPY --from=build /workspace/build/libs/app.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]Clean build context and reproducibility
- Use lock files, wrappers, and pinned versions when the project supports them.
- Check builds on a clean runner rather than only with a local cache.
- Keep README, scripts, Gradle tasks, Dockerfile, and Compose consistent.
- Do not rely on a running local service or hidden .env.
- Use .dockerignore for .git, .gradle, node_modules, .env, and unnecessary output directories.
build / assemble
-> image exists
-> container starts
-> health endpoint responds
-> command and result recordedClaude can analyze, but does not replace the build
If bootJar fails, diagnose the application build first. If the image builds but the health endpoint fails, inspect runtime, port, environment, and startup time. Do not hide a failure by rewriting the Dockerfile quickly.
- Pass the relevant build file, Dockerfile, Compose fragment, and error log.
- Ask for mismatches and the smallest checks.
- Forbid broad edits, dependency updates, and pushes.
- Verify the proposed command with an actual build.
- Save the analysis separately from source and smoke evidence.
Smoke check as a viability criterion
| Signal | What to inspect on failure |
|---|---|
| Build did not create an artifact | Build command, dependencies, and output paths |
| Image did not build | Dockerfile, context, COPY, and base image |
| Container exits immediately | Entrypoint, environment, and runtime log |
| Health endpoint does not respond | Port, readiness, profile, and startup time |
| Local green, CI red | Caches, hidden variables, and runner differences |
docker compose build backend
docker compose up -d backend
curl --fail http://localhost:8080/actuator/health
docker compose logs backend --tail=40
docker compose downCanonical lesson source · JavaRush
Open JavaRush material