Skip to content

Commit

Permalink
feat: add localnet Dockerfile (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov authored Nov 15, 2023
1 parent 44e8943 commit beb957b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github
scripts
target
Dockerfile
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM rust:1.71 AS builder
WORKDIR /tmp/

# Copy from nearcore:
# https://github.com/near/nearcore/blob/master/Dockerfile
RUN apt-get update -qq && \
apt-get install -y \
git \
cmake \
g++ \
pkg-config \
libssl-dev \
curl \
llvm \
clang

COPY . .

# build for release
RUN cargo build --release

FROM debian:bookworm-slim as runtime
WORKDIR /near-lake-app

RUN apt update && apt install -yy openssl ca-certificates jq

COPY --from=builder /tmp/target/release/near-lake .
COPY ./entrypoint.sh entrypoint.sh
ENTRYPOINT [ "./entrypoint.sh" ]
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Initialize NEAR Lake to generate config and genesis
/near-lake-app/near-lake init --chain-id localnet

# Tweak nearcore config to track all shards
tmp=$(mktemp)
jq '.tracked_shards = [0]' /root/.near/config.json >"$tmp" && mv "$tmp" /root/.near/config.json

/near-lake-app/near-lake run "$@"

0 comments on commit beb957b

Please sign in to comment.