Skip to content

Commit f34cbf0

Browse files
committed
fix: restored dockerfile and removed dockerignore
1 parent cbf661d commit f34cbf0

File tree

4 files changed

+36
-122
lines changed

4 files changed

+36
-122
lines changed

.dockerignore

Lines changed: 0 additions & 25 deletions
This file was deleted.

Dockerfile

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
1-
# Runtime image expecting a pre-built binary alongside the Docker build context.
2-
FROM ubuntu:20.04
1+
FROM docker.io/library/ubuntu:20.04
32

4-
# Metadata
5-
ARG VCS_REF=unknown
6-
ARG BUILD_DATE=unknown
3+
# metadata
4+
ARG VCS_REF
5+
ARG BUILD_DATE
76

87
LABEL io.parity.image.authors="[email protected]" \
9-
io.parity.image.vendor="Parity Technologies" \
10-
io.parity.image.title="polkadot-staking-miner" \
11-
io.parity.image.description="Polkadot staking miner for substrate based chains" \
12-
io.parity.image.source="https://github.com/paritytech/polkadot-staking-miner/blob/${VCS_REF}/Dockerfile" \
13-
io.parity.image.revision="${VCS_REF}" \
14-
io.parity.image.created="${BUILD_DATE}" \
15-
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
16-
17-
# Backtraces & useful defaults
18-
ENV RUST_BACKTRACE=1 \
19-
SEED="" \
20-
URI="wss://rpc.polkadot.io" \
21-
RUST_LOG="info"
22-
23-
# Install runtime dependencies (libssl1.1 still available on focal)
8+
io.parity.image.vendor="Parity Technologies" \
9+
io.parity.image.title="polkadot-staking-miner" \
10+
io.parity.image.description="Polkadot staking miner for substrate based chains" \
11+
io.parity.image.source="https://github.com/paritytech/polkadot-staking-miner/blob/${VCS_REF}/Dockerfile" \
12+
io.parity.image.revision="${VCS_REF}" \
13+
io.parity.image.created="${BUILD_DATE}" \
14+
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
15+
16+
# show backtraces
17+
ENV RUST_BACKTRACE 1
18+
19+
# install tools and dependencies
2420
RUN apt-get update && \
2521
DEBIAN_FRONTEND=noninteractive apt-get install -y \
26-
libssl1.1 \
27-
ca-certificates && \
22+
libssl1.1 \
23+
ca-certificates && \
24+
# apt cleanup
2825
apt-get autoremove -y && \
2926
apt-get clean && \
30-
find /var/lib/apt/lists/ -type f -not -name lock -delete && \
27+
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
3128
useradd -u 10000 -U -s /bin/sh miner
3229

33-
# Copy the pre-built binary into the image
30+
# add binary to docker image
3431
COPY ./polkadot-staking-miner /usr/local/bin
3532

36-
# Create writable workspace and output directories
37-
RUN mkdir -p /workspace/results /workspace/outputs && \
38-
chmod 777 /workspace /workspace/results /workspace/outputs && \
39-
/usr/local/bin/polkadot-staking-miner --version
33+
USER miner
4034

41-
WORKDIR /workspace
35+
ENV SEED=""
36+
ENV URI="wss://rpc.polkadot.io"
37+
ENV RUST_LOG="info"
4238

43-
ENTRYPOINT ["/usr/local/bin/polkadot-staking-miner"]
44-
CMD ["--help"]
39+
# check if the binary works in this container
40+
RUN /usr/local/bin/polkadot-staking-miner --version
41+
42+
ENTRYPOINT [ "/usr/local/bin/polkadot-staking-miner" ]

Dockerfile.README.md

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,3 @@
33
[GitHub](https://github.com/paritytech/polkadot-staking-miner)
44

55
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)
6-
7-
## Using Pre-built Docker Image
8-
9-
### Pull the image from Docker Hub
10-
11-
```bash
12-
docker pull polkadot-staking-miner
13-
```
14-
15-
Or if using a specific registry:
16-
17-
```bash
18-
docker pull <registry>/polkadot-staking-miner:<tag>
19-
```
20-
21-
### Run prediction with custom file
22-
23-
```bash
24-
sudo docker run --rm \
25-
-v "$(pwd):/workspace" \
26-
polkadot-staking-miner \
27-
--uri wss://westend-asset-hub-rpc.polkadot.io \
28-
predict --custom-file custom.json --desired-validators 1
29-
```
30-
31-
### Run basic prediction
32-
33-
```bash
34-
docker run --rm \
35-
-v "$(pwd):/workspace" \
36-
polkadot-staking-miner \
37-
--uri wss://westend-asset-hub-rpc.polkadot.io \
38-
predict
39-
```
40-
41-
## Building Locally
42-
43-
If you need to build the image locally:
44-
45-
```bash
46-
docker build -t polkadot-staking-miner .
47-
```
48-
49-
50-
51-
### Pull the image from Docker Hub
52-
53-
54-
sudo docker pull paritytech/staking-miner-v2:latest
55-
56-
### for custom validators
57-
58-
sudo docker run --rm -v "$(pwd):/workspace" paritytech/staking-miner-v2:latest --uri wss://westend-asset-hub-rpc.polkadot.io predict --custom-file custom.json --desired-validators 1
59-
60-
61-
### for basic prediction
62-
63-
sudo docker run --rm -v "$(pwd):/workspace" paritytech/staking-miner-v2:latest --uri wss://westend-asset-hub-rpc.polkadot.io predict
64-
65-
### monitor command
66-
67-
sudo docker run --rm -v "$(pwd):/workspace" paritytech/staking-miner-v2:latest --uri wss://westend-asset-hub-rpc.polkadot.io monitor --seed-or-path //Alice
68-
69-
### info commanda
70-
71-
sudo docker run --rm -v "$(pwd):/workspace" paritytech/staking-miner-v2:latest --uri wss://westend-asset-hub-rpc.polkadot.io info

src/dynamic/election_data.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ pub(crate) fn inject_self_votes(
125125
combined.len()
126126
);
127127

128+
combined.sort_by(|a, b| {
129+
// Sort by Stake Descending (High stake first)
130+
b.1.cmp(&a.1)
131+
// Tie-breaker: AccountId Ascending (for deterministic stability)
132+
.then_with(|| a.0.cmp(&b.0))
133+
});
134+
128135
combined
129136
}
130137

0 commit comments

Comments
 (0)