-
Notifications
You must be signed in to change notification settings - Fork 110
feat: Validator binary crate, Dockerfile, and Debian package #2053
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: next
Are you sure you want to change the base?
Changes from all commits
5190a34
935377e
3d55610
fc6be76
cbba850
b28ce85
15d93a9
1b4da98
948785c
5a2510d
6dce3fb
f841cb8
ca16628
8863563
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
|
Collaborator
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. This will come up a bunch. Should we create separate "base images" for building and runtime?
Contributor
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. As far as I understand that's not possible without using some extensions. We could add dockerfile-x though and move the builder and runner image definitions to a common Dockerfile referenced by the per-service Dockerfiles.
Collaborator
Author
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. I have gone with a merged Dockerfile with ARGs for bin and port. Might not be flexible enough for us in the end, but it might be (same will work fine for the ntx-builder image).
Collaborator
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. Lets see how it goes. I don't like that it assumes the binaries are the same and can be coupled like this. I think what I was assuming originally is that we would publish build and runtime base images. I don't understand why that isn't possible; isn't that how exist? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| ARG BIN | ||
| ARG PORT | ||
|
|
||
| FROM rust:1.93-slim-bookworm AS chef | ||
| # Install build dependencies. RocksDB is compiled from source by librocksdb-sys. | ||
| RUN apt-get update && \ | ||
|
|
@@ -20,12 +23,13 @@ COPY . . | |
| RUN cargo chef prepare --recipe-path recipe.json | ||
|
|
||
| FROM chef AS builder | ||
| ARG BIN | ||
| COPY --from=planner /app/recipe.json recipe.json | ||
| # Build dependencies - this is the caching Docker layer! | ||
| RUN cargo chef cook --release --recipe-path recipe.json | ||
| # Build application | ||
| COPY . . | ||
| RUN cargo build --release --locked --bin miden-node | ||
| RUN cargo build --release --locked --bin ${BIN} | ||
|
|
||
| # Base line runtime image with runtime dependencies installed. | ||
| FROM debian:bookworm-slim AS runtime-base | ||
|
|
@@ -35,7 +39,9 @@ RUN apt-get update && \ | |
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| FROM runtime-base AS runtime | ||
| COPY --from=builder /app/target/release/miden-node /usr/local/bin/miden-node | ||
| ARG BIN | ||
| ARG PORT | ||
| COPY --from=builder /app/target/release/${BIN} /usr/local/bin/${BIN} | ||
| LABEL [email protected] \ | ||
| org.opencontainers.image.url=https://0xMiden.github.io/ \ | ||
| org.opencontainers.image.documentation=https://github.com/0xMiden/node \ | ||
|
|
@@ -48,8 +54,7 @@ ARG COMMIT | |
| LABEL org.opencontainers.image.created=$CREATED \ | ||
| org.opencontainers.image.version=$VERSION \ | ||
| org.opencontainers.image.revision=$COMMIT | ||
|
|
||
| # Expose RPC port | ||
| EXPOSE 57291 | ||
| # Miden node does not spawn sub-processes, so it can be used as the PID1. | ||
| CMD ["miden-node"] | ||
| EXPOSE ${PORT} | ||
| # Use exec to replace the shell so the binary runs as PID 1. | ||
| ENV MIDEN_BIN=${BIN} | ||
| CMD ["/bin/sh", "-c", "exec /usr/local/bin/$MIDEN_BIN"] | ||
Uh oh!
There was an error while loading. Please reload this page.