-
-
Notifications
You must be signed in to change notification settings - Fork 95
build(docker): add Dockerfile for building a server image #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| target/ | ||
| dist/ | ||
| aw-webui/dist/ | ||
| aw-webui/node_modules/ | ||
| **/node_modules/ | ||
| .cov/ | ||
| coverage-html/ | ||
| .serena/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Build stage: aw-webui (node) + aw-server (rust, with the webui embedded via rust-embed) | ||
| FROM rust:1-bookworm AS builder | ||
|
|
||
| RUN apt-get update -qq -y && \ | ||
| apt-get install -qq -y --no-install-recommends \ | ||
| build-essential pkg-config libssl-dev ca-certificates curl git make gnupg && \ | ||
| curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ | ||
| apt-get install -qq -y --no-install-recommends nodejs && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app/aw-server-rust | ||
| COPY . . | ||
|
|
||
| # `make aw-server` builds the webui (aw-webui/dist) before cargo, so that | ||
| # aw-server's build.rs can embed the assets into the binary. | ||
| # We avoid the `build` target, which also builds aw-sync: that binary pulls in | ||
| # openssl with the "vendored" feature (builds OpenSSL from source) and is not | ||
| # used by this image. | ||
| RUN make aw-server | ||
|
|
||
| FROM debian:bookworm-slim | ||
|
|
||
| RUN apt-get update -qq -y && \ | ||
| apt-get install -qq -y --no-install-recommends \ | ||
| libssl3 && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY --from=builder /app/aw-server-rust/target/release/aw-server /usr/local/bin/aw-server-rust | ||
| COPY --from=builder /app/aw-server-rust/aw-webui/dist /usr/local/share/aw-webui | ||
|
|
||
| EXPOSE 5600 | ||
|
|
||
| CMD ["aw-server-rust"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The runtime stage has no |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the floating NodeSource endpoint is compromised, intercepted, or changed unexpectedly, its response executes directly as root in the builder stage and can modify the server or web assets copied into the runtime image, causing the published image to contain unreviewed code. How this was verified: The remote response runs before
make aw-serverin the same builder stage whose outputs are copied into the final image.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!