Skip to content

Commit

Permalink
Add Dockerfile to repo (#30)
Browse files Browse the repository at this point in the history
Finally include dockerfile, and tweaks readme instructions
  • Loading branch information
ebatsell authored Apr 9, 2024
1 parent 33979e3 commit d813d4f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM rust:1.71-slim-buster as builder

RUN apt-get update && apt-get install -y libudev-dev clang pkg-config libssl-dev build-essential cmake protobuf-compiler

RUN update-ca-certificates

WORKDIR /usr/src/app

COPY . .

RUN --mount=type=cache,mode=0777,target=/home/root/app/target \
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry \
cargo build --release --bin validator-keeper

#########

FROM debian:buster as validator-history
RUN apt-get update && apt-get install -y ca-certificates
ENV APP="validator-keeper"

COPY --from=builder /usr/src/app/target/release/$APP ./$APP

ENTRYPOINT ./$APP

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ Note that this is a `zero_copy` account, which allows us to initialize a lot of

## Test

Tests are in `tests/` written with solana-program-test.
Tests are in `tests/` written with solana-program-test.

One should run their tests in the SBF interpreter. That can be done with the following:

```shell
$ anchor build && SBF_OUT_DIR=$(pwd)/target/deploy cargo test
```
Expand All @@ -48,9 +49,9 @@ Run as binary:

Build: `cargo b -r --package validator-keeper`

Run: `./target/release/validator-keeper --json-rpc-url <YOUR RPC> --cluster mainnet --tip-distribution-program-id F2Zu7QZiTYUhPd7u9ukRVwxh7B71oA3NMJcHuCHc29P2 --program-id HistoryJTGbKQD2mRgLZ3XhqHnN811Qpez8X9kCcGHoa --interval 600 --keypair <YOUR KEYPAIR> --gossip-entrypoint <GOSSIP ENDPOINT>`
Run: `./target/release/validator-keeper --json-rpc-url <YOUR RPC> --cluster mainnet --tip-distribution-program-id F2Zu7QZiTYUhPd7u9ukRVwxh7B71oA3NMJcHuCHc29P2 --program-id HistoryJTGbKQD2mRgLZ3XhqHnN811Qpez8X9kCcGHoa --interval 600 --keypair <YOUR KEYPAIR>`

Run as docker container:
Run as docker container (need to set environment variables in config/.env file):

`docker compose --env-file config/.env up -d --build validator-keeper`

Expand Down

0 comments on commit d813d4f

Please sign in to comment.