-
Notifications
You must be signed in to change notification settings - Fork 20
Feat/offline election prediction tool #1189
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
Changes from 14 commits
38269b8
531191f
b9abed4
57a25c0
4648815
342d700
7e16bce
f51f470
932e913
4d370fd
bc8c325
7f80138
f60a578
5a5b6f3
d5995ca
16ad14b
d13195d
22a40eb
08ccbbc
17275b7
945aeee
0a038aa
de6701f
aaeb8f5
cbf661d
f34cbf0
7e626e1
ab9cdfd
55e1502
2202fd6
fc798f6
6a957d6
74bcabb
5a69b41
a8c53fc
c1a4756
b351c77
22ab2e4
a9a6670
c887d92
485db87
3b5a346
fb2333f
76ebc86
8415e40
c3ba626
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,25 @@ | ||
| # Ignore build artifacts and large/generated data to keep the context slim. | ||
| target/* | ||
| !target/release/ | ||
| target/release/* | ||
| !target/release/polkadot-staking-miner | ||
| results | ||
| artifacts/tmp | ||
|
|
||
| # Git metadata and local configs. | ||
| .git | ||
| .gitignore | ||
| .github | ||
|
|
||
| # Editor / OS files. | ||
| *.swp | ||
| *.swo | ||
| *.log | ||
| *.tmp | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Docker related. | ||
| Dockerfile.README.md | ||
| docker-compose* | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,44 @@ | ||
| FROM docker.io/library/ubuntu:20.04 | ||
| # Runtime image expecting a pre-built binary alongside the Docker build context. | ||
| FROM ubuntu:20.04 | ||
|
|
||
| # metadata | ||
| ARG VCS_REF | ||
| ARG BUILD_DATE | ||
| # Metadata | ||
| ARG VCS_REF=unknown | ||
| ARG BUILD_DATE=unknown | ||
|
|
||
| LABEL io.parity.image.authors="[email protected]" \ | ||
| io.parity.image.vendor="Parity Technologies" \ | ||
| io.parity.image.title="polkadot-staking-miner" \ | ||
| io.parity.image.description="Polkadot staking miner for substrate based chains" \ | ||
| io.parity.image.source="https://github.com/paritytech/polkadot-staking-miner/blob/${VCS_REF}/Dockerfile" \ | ||
| io.parity.image.revision="${VCS_REF}" \ | ||
| io.parity.image.created="${BUILD_DATE}" \ | ||
| io.parity.image.documentation="https://github.com/paritytech/polkadot/" | ||
|
|
||
| # show backtraces | ||
| ENV RUST_BACKTRACE 1 | ||
|
|
||
| # install tools and dependencies | ||
| io.parity.image.vendor="Parity Technologies" \ | ||
|
||
| io.parity.image.title="polkadot-staking-miner" \ | ||
| io.parity.image.description="Polkadot staking miner for substrate based chains" \ | ||
| io.parity.image.source="https://github.com/paritytech/polkadot-staking-miner/blob/${VCS_REF}/Dockerfile" \ | ||
| io.parity.image.revision="${VCS_REF}" \ | ||
| io.parity.image.created="${BUILD_DATE}" \ | ||
| io.parity.image.documentation="https://github.com/paritytech/polkadot/" | ||
|
|
||
| # Backtraces & useful defaults | ||
| ENV RUST_BACKTRACE=1 \ | ||
| SEED="" \ | ||
| URI="wss://rpc.polkadot.io" \ | ||
|
||
| RUST_LOG="info" | ||
|
|
||
| # Install runtime dependencies (libssl1.1 still available on focal) | ||
| RUN apt-get update && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| libssl1.1 \ | ||
| ca-certificates && \ | ||
| # apt cleanup | ||
| libssl1.1 \ | ||
| ca-certificates && \ | ||
| apt-get autoremove -y && \ | ||
| apt-get clean && \ | ||
| find /var/lib/apt/lists/ -type f -not -name lock -delete; \ | ||
| find /var/lib/apt/lists/ -type f -not -name lock -delete && \ | ||
| useradd -u 10000 -U -s /bin/sh miner | ||
|
|
||
| # add binary to docker image | ||
| COPY ./polkadot-staking-miner /usr/local/bin | ||
| # Copy the pre-built binary into the image | ||
| COPY target/release/polkadot-staking-miner /usr/local/bin/polkadot-staking-miner | ||
|
|
||
| USER miner | ||
| # Create writable workspace and output directories | ||
| RUN mkdir -p /workspace/results /workspace/outputs && \ | ||
| chmod 777 /workspace /workspace/results /workspace/outputs && \ | ||
| /usr/local/bin/polkadot-staking-miner --version | ||
|
|
||
| ENV SEED="" | ||
| ENV URI="wss://rpc.polkadot.io" | ||
| ENV RUST_LOG="info" | ||
| WORKDIR /workspace | ||
|
|
||
| # check if the binary works in this container | ||
| RUN /usr/local/bin/polkadot-staking-miner --version | ||
|
|
||
| ENTRYPOINT [ "/usr/local/bin/polkadot-staking-miner" ] | ||
| ENTRYPOINT ["/usr/local/bin/polkadot-staking-miner"] | ||
| CMD ["--help"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,62 @@ | |
|
|
||
| [GitHub](https://github.com/paritytech/polkadot-staking-miner) | ||
|
|
||
| Formerly known as `staking-miner-v2` historical images versions are available in the [hub.docker.com](https://hub.docker.com/r/paritytech/staking-miner-v2) | ||
| Formerly known as `staking-miner-v2` historical images versions are available in the [hub.docker.com](https://hub.docker.com/r/paritytech/staking-miner-v2) | ||
sigurpol marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Using Pre-built Docker Image | ||
|
|
||
| ### Pull the image from Docker Hub | ||
|
|
||
| ```bash | ||
| docker pull polkadot-staking-miner | ||
| ``` | ||
|
|
||
| Or if using a specific registry: | ||
|
|
||
| ```bash | ||
| docker pull <registry>/polkadot-staking-miner:<tag> | ||
| ``` | ||
|
|
||
| ### Run prediction with custom file | ||
|
||
|
|
||
| ```bash | ||
| sudo docker run --rm \ | ||
| -v "$(pwd):/workspace" \ | ||
| polkadot-staking-miner \ | ||
| --uri wss://westend-asset-hub-rpc.polkadot.io \ | ||
| predict --custom-file custom.json --desired-validators 1 | ||
| ``` | ||
|
|
||
| ### Run basic prediction | ||
|
|
||
| ```bash | ||
| docker run --rm \ | ||
| -v "$(pwd):/workspace" \ | ||
| polkadot-staking-miner \ | ||
| --uri wss://westend-asset-hub-rpc.polkadot.io \ | ||
| predict | ||
| ``` | ||
|
|
||
| ## Building Locally | ||
|
|
||
| If you need to build the image locally: | ||
|
|
||
| ```bash | ||
| docker build -t polkadot-staking-miner . | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ### Pull the image from Docker Hub | ||
|
|
||
|
|
||
| sudo docker pull antiers/polkadot-staking-miner:latest | ||
|
||
|
|
||
| ### for custom validators | ||
|
|
||
| sudo docker run --rm -v "$(pwd):/workspace" ant/polkadot-staking-miner:latest --uri wss://westend-asset-hub-rpc.polkadot.io predict --custom-file custom.json --desired-validators 1 | ||
|
||
|
|
||
|
|
||
| ### for basic prediction | ||
|
|
||
| sudo docker run --rm -v "$(pwd):/workspace" antiers/polkadot-staking-miner:latest --uri wss://westend-asset-hub-rpc.polkadot.io predict | ||
|
||
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 would remove this file honestly - seems a bit out of scope for this PR