Distroless builds - httpserver-java21-distroless - #453
Conversation
72e5456 to
74e0a18
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new server implementation has a real cross-thread visibility issue (startupDuration) and the distroless Dockerfile contains inaccurate/non-English header commentary that should be corrected.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new httpserver-java21 variant that builds the app filesystem using a distroless Java 21 runtime image (gcr.io/distroless/java21-debian13) instead of a manually curated scratch rootfs, along with documentation and an end-to-end test.
Changes:
- Introduces a distroless-based Dockerfile/rootfs and corresponding
Kraftfilefor deployment. - Adds a README documenting build/run steps for Unikraft Cloud (unikraft + legacy kraft CLIs).
- Adds a Java HTTP server implementation and an e2e test validating it serves “Hello, World!”.
File summaries
| File | Description |
|---|---|
| httpserver-java21-distroless/Dockerfile | Multi-stage build compiling Java 21 then using a distroless runtime stage. |
| httpserver-java21-distroless/Kraftfile | Unikraft Cloud spec pointing rootfs to the Dockerfile and providing the Java cmd. |
| httpserver-java21-distroless/README.md | Usage and customization guide for the distroless variant. |
| httpserver-java21-distroless/SimpleHttpServer.java | Minimal Java HTTP server serving “Hello, World!” plus boot time info. |
| httpserver-java21-distroless/test_httpserver-java21-distroless.py | E2E test building/running the example and asserting response content. |
Review details
Suppressed comments (1)
httpserver-java21-distroless/SimpleHttpServer.java:34
response.getBytes()uses the platform default charset and is called multiple times. Use a deterministic charset and reuse the encoded bytes to avoid inconsistent encoding across environments and avoid duplicate work.
String response = "Hello, World!\n[Unikraft Speed] Boot time: " + startupDuration + " ms\n";
exchange.sendResponseHeaders(200, response.getBytes().length);
OutputStream os = exchange.getResponseBody();
os.write(response.getBytes());
os.close();
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
74e0a18 to
486b91c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The Dockerfile’s distroless runtime stage is not pinned to --platform=linux/x86_64, which can produce an incompatible rootfs when building on non-x86_64 hosts.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
Add distroless variant of httpserver-java21 example. Use gcr.io/distroless/java21-debian13 as runtime base. Add Dockerfile, Kraftfile, README, and test file. Signed-off-by: Teodor Constantinescu <constantinescu.teodor22@gmail.com>
486b91c to
05bce35
Compare
Uh oh!
There was an error while loading. Please reload this page.