Skip to content

feature: multi-stage non-root Dockerfile for Conduit backend (SQLite on /data volume) - #1153

Closed
devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1791828644-containerize
Closed

devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1791828644-containerize

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Multi-stage, non-root Docker image for the Conduit Spring Boot backend. Paired frontend PR, which holds docker-compose.yml and the nginx /api proxy: COG-GTM/angular-realworld-example-app#82

  • Build stage: eclipse-temurin:11-jdk with --platform=$BUILDPLATFORM, ./gradlew bootJar -x test, and a Gradle cache mount.
  • Runtime: eclipse-temurin:11-jre-jammy, user conduit (uid/gid 10001). SPRING_DATASOURCE_URL=jdbc:sqlite:/data/conduit.db and VOLUME /data.
    • Not Alpine: 11-jre-alpine is amd64-only, and sqlite-jdbc 3.36 only ships an x86_64 Alpine native lib, so ARM64 (e.g. Apple Silicon) couldn't build or run.
    • Pinned uid so volume ownership doesn't drift when the base image changes (an Alpine → Ubuntu switch made an existing volume SQLITE_READONLY).
  • docker/maven-mirror.init.gradle + optional MAVEN_MIRROR build arg: Maven Central rate-limits (HTTP 429) some CI/VM IPs. It does nothing when unset.
  • No application code changed.

Open question (Devin Review): jwt.secret still defaults to the value committed in application.properties. Override at runtime with JWT_SECRET=... (Spring relaxed binding). I didn't make it mandatory, so local docker compose up stays one command.

Test results

Layer Result Notes
Backend unit (./gradlew test) ✅ 68 / 68 pass no backend Java changed
Frontend unit (bun run test -- --run) ✅ 183 / 183 pass (7 files) was 0 files loading on master: zone.js missing. Added it + 3 API_URL interceptor tests
hurl auth.hurl (8.0.1, host=http://localhost:8080) ❌ fail spec drift: backend returns bio: "" and a placeholder image where the spec expects null, and bio/image can't be set back to null
hurl articles.hurl ❌ fail spec drift: POST /articles returns 200 (spec says 201), and list responses include body (newer spec leaves it out)
Computer-use acceptance (recorded) ✅ flow pass · ⚠️ 2 visual issues register → markdown article w/ 2 tags → renders → comment → favorite → logout/login → docker compose restart → all persisted. Issues listed below

The hurl failures come from the Spring backend implementing an older RealWorld spec, not from the container/proxy. Every request (register, login, create, list) goes through nginx /api → backend and gets an application response. I didn't change backend semantics to make them pass.

Visual issues on screen (pre-existing, not touched in this PR):

  • Default avatar https://static.productionready.io/images/smiley-cyrus.jpg (set by the backend) returns 404, so nav, article meta, comments and profile show broken images.
  • At 390px, signed-in nav overflows (scrollWidth 420 > clientWidth 390) on home and article pages, and preview tags touch the dividers.

Acceptance run (annotated, sped up)

Markdown + 2 tags rendered After docker compose restart Favorite persisted 390px

After the acceptance run the backend runtime changed (Alpine → 11-jre-jammy for ARM64, uid/gid pinned to 10001; see backend PR). I re-checked that image with docker compose up -d --build: the container was recreated on the same conduit-data volume, the QA article, comment and favorite were still there, register returned 201, and hurl showed the same failure profile.

Run it

# sibling checkouts: ./angular-realworld-example-app and ./spring-boot-realworld-example-app
cd angular-realworld-example-app
git submodule update --init
docker compose up -d --build        # → http://localhost:8080
# optional: CONDUIT_PORT=9000, BACKEND_CONTEXT=/path/to/backend,
#           MAVEN_MIRROR=https://maven-central.storage-download.googleapis.com/maven2 (if Maven Central rate-limits you)
hurl --test --variable host=http://localhost:8080 --variable uid=$RANDOM realworld/specs/api/hurl/{auth,articles}.hurl

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/64408f2009084eb083deff72f37361bd
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/64408f2009084eb083deff72f37361bd?variant=devin
Requested by: @parkerduff


Note

Devin errored when opening this Pull Request as parkerduff.
As a fallback, Devin opened this PR as itself.


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Devin Review (Staging)


Devin Review

…data volume

Co-Authored-By: Parker Duff <pwjduff@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 2 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread Dockerfile Resolved
Comment thread Dockerfile
WORKDIR /app
COPY --from=build /app/app.jar app.jar
USER conduit
ENV SPRING_DATASOURCE_URL=jdbc:sqlite:/data/conduit.db

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 Default image permits forged login tokens

With the default jwt.secret, anyone who knows the repository key can sign tokens for existing user IDs. JwtTokenFilter accepts those tokens and authenticates the attacker as that user.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid concern, but it isn't introduced by this PR. The hardcoded jwt.secret default lives in src/main/resources/application.properties on master, and the image just inherits it. It can be overridden at runtime without code changes: Spring relaxed binding maps JWT_SECRET → jwt.secret (e.g. docker run -e JWT_SECRET=..., or an environment: entry in compose). I'm not making it mandatory here, because that would break the one-command docker compose up local stack this PR targets. I've flagged it to the requester to decide whether the image should refuse to start without a secret. Leaving this thread open.

devin-ai-integration Bot and others added 2 commits October 12, 2026 18:15
…s on ARM64

Co-Authored-By: Parker Duff <pwjduff@gmail.com>
…s stable across base-image changes

Co-Authored-By: Parker Duff <pwjduff@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread Dockerfile Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants