-
Notifications
You must be signed in to change notification settings - Fork 44
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
Dockerize node #257
Dockerize node #257
Changes from all commits
e1c2e9b
8f28a4d
80c60b3
042ad7f
ac7ebe7
2d01181
47a76e9
20b4262
3e77d00
96f4a8b
8298f8f
59e461d
891f77e
04a21d4
21ee551
29f38c5
7b97987
53d9c96
494bb55
c9ed28f
5fb9679
89883af
203f6b1
ddc3c88
eac99cd
8600cf5
d04e71e
d09f6f9
8d138ec
1732666
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,38 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
./bin | ||
./target | ||
/bin | ||
/target | ||
LICENSE | ||
README.md | ||
accounts | ||
genesis.dat | ||
miden-store.* | ||
store.* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Runs the CI | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
|
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. Quick question: why do we need to duplicate this file here? 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. We do not need to, fixed it in the next PR. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This is an example configuration file for the Miden node. | ||
|
||
[block_producer] | ||
# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-block-producer', 1)) % 2**16 | ||
endpoint = { host = "localhost", port = 48046 } | ||
store_url = "http://localhost:28943" | ||
# enables or disables the verification of transaction proofs before they are accepted into the | ||
# transaction queue. | ||
verify_tx_proofs = true | ||
|
||
[rpc] | ||
# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-rpc', 1)) % 2**16 | ||
endpoint = { host = "0.0.0.0", port = 57291 } | ||
block_producer_url = "http://localhost:48046" | ||
store_url = "http://localhost:28943" | ||
|
||
[store] | ||
# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-store', 1)) % 2**16 | ||
endpoint = { host = "localhost", port = 28943 } | ||
database_filepath = "db/miden-store.sqlite3" | ||
genesis_filepath = "genesis.dat" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Miden node Dockerfile | ||
|
||
# Setup image builder | ||
FROM rust:1.76-slim-bookworm AS builder | ||
|
||
# Install dependencies | ||
RUN apt-get update && \ | ||
apt-get -y upgrade && \ | ||
apt-get install -y llvm clang bindgen pkg-config libssl-dev libsqlite3-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy source code | ||
WORKDIR /app | ||
COPY . . | ||
|
||
# Build the node crate | ||
RUN cargo install --features testing --path node | ||
RUN miden-node make-genesis --inputs-path node/genesis.toml | ||
|
||
# Run Miden node | ||
FROM debian:bookworm-slim | ||
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. Note: The final image has an okay size:
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. Note: 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.
Do you have ideas in mind to improve on it? 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 is positive right? 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 think this size is good enough. I was just adding context to the PR.
Yes. This was not a request. I was just adding context to the PR. |
||
|
||
# Update machine & install required packages | ||
# The instalation of sqlite3 is needed for correct function of the SQLite database | ||
RUN apt-get update && \ | ||
apt-get -y upgrade && \ | ||
apt-get install -y --no-install-recommends \ | ||
sqlite3 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy artifacts from the builder stage | ||
COPY --from=builder /app/genesis.dat genesis.dat | ||
COPY --from=builder /app/accounts accounts | ||
COPY --from=builder /usr/local/cargo/bin/miden-node /usr/local/bin/miden-node | ||
|
||
# Set labels | ||
LABEL [email protected] \ | ||
org.opencontainers.image.url=https://0xpolygonmiden.github.io/ \ | ||
org.opencontainers.image.documentation=https://github.com/0xPolygonMiden/miden-node \ | ||
org.opencontainers.image.source=https://github.com/0xPolygonMiden/miden-node \ | ||
org.opencontainers.image.vendor=Polygon \ | ||
org.opencontainers.image.licenses=MIT | ||
|
||
ARG CREATED | ||
ARG VERSION | ||
ARG COMMIT | ||
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. Can we move all args to the top (line 27 or even top of file) and group all labels into one single 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 think this is not a good idea. When I'm debugging the DockerFile, I will rebuild the same image multiple times using the same The Please move it down, as far as you can. Here is the docs |
||
LABEL org.opencontainers.image.created=$CREATED \ | ||
org.opencontainers.image.version=$VERSION \ | ||
org.opencontainers.image.revision=$COMMIT | ||
|
||
# Expose RPC port | ||
EXPOSE 57291 | ||
|
||
# Start the Miden node | ||
# Miden node does not spawn sub-processes, so it can be used as the PID1 | ||
CMD miden-node start --config miden-node.toml |
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.
This is not working for me. Maybe it is a different among podman and docker. But this is causing me to upload 11G of data to the docker VM, and at first sign it looked like podman wasn't working.
Can you change the paths from
/bin
and/target
to./bin
and./target
? And also test on your machine?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.
I now wonder how the
--mount
is implemented onMacOs
, because I may have given bad advice with the cargo cache below, if the data has to be copied to the VM.