diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0d543cd2 --- /dev/null +++ b/Dockerfile @@ -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 + diff --git a/README.md b/README.md index 58eb9f91..9eaba24a 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -48,9 +49,9 @@ Run as binary: Build: `cargo b -r --package validator-keeper` -Run: `./target/release/validator-keeper --json-rpc-url --cluster mainnet --tip-distribution-program-id F2Zu7QZiTYUhPd7u9ukRVwxh7B71oA3NMJcHuCHc29P2 --program-id HistoryJTGbKQD2mRgLZ3XhqHnN811Qpez8X9kCcGHoa --interval 600 --keypair --gossip-entrypoint ` +Run: `./target/release/validator-keeper --json-rpc-url --cluster mainnet --tip-distribution-program-id F2Zu7QZiTYUhPd7u9ukRVwxh7B71oA3NMJcHuCHc29P2 --program-id HistoryJTGbKQD2mRgLZ3XhqHnN811Qpez8X9kCcGHoa --interval 600 --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`