Dockerfile
must be placed at the root of beerus project.
FROM rust:1.69 as builder
WORKDIR /beerus
COPY . .
RUN cargo build --all --locked --release
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builder /beerus/target/release/beerus /usr/local/bin/
COPY --from=builder /beerus/target/release/beerus-rpc /usr/local/bin/
LABEL description="Docker image for Beerus, light client for Starknet." \
image.authors="Keep Starknet Strange team." \
image.description="Docker image for Beerus, light client for Starknet." \
image.source="https://github.com/keep-starknet-strange/beerus" \
image.documentation="https://github.com/keep-starknet-strange/beerus"
EXPOSE 3030
# Uncomment the line below for helios RPC if we still have 2 endpoints.
#EXPOSE 3031
# Can be changed to beerus if needed. But RPC has more usages.
ENTRYPOINT ["/usr/local/bin/beerus-rpc"]
Do not forget to add the following .dockerignore
file at the same level of the Dockerfile
.
This avoid copying all build artifacts and git stuff.
**/target/
.git
.github
To build, go into the beerus root directory and run: docker build -t beerus-rpc .
To run the container correctly, an environment file is expected to set the variables used by beerus. The following file is an example:
ETHEREUM_NETWORK=mainnet
ETHEREUM_CONSENSUS_RPC_URL=https://www.lightclientdata.org
ETHEREUM_EXECUTION_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/XXXX
STARKNET_RPC_URL=https://starknet-mainnet.infura.io/v3/XXXX
DATA_DIR=/tmp/
docker run --rm --init --env-file ../beerus_docker.env beerus-rpc
Some details here:
--init
option is used to ensure a PID 1 process is started before our. Usefull to keep the possibility to kill the container with signals.--rm
to auto remove the container when killed / stopped.--env-file
the path to the file of the previous step.