Skip to content

Commit

Permalink
indexer dockerfile (#320)
Browse files Browse the repository at this point in the history
* indexer dockerfile

* typo

* fix dockerfile

* old dep for econia

* use lld instead of mold

* woopsy
  • Loading branch information
qdrs authored Jul 20, 2023
1 parent ddd1900 commit 1e73a99
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/target
37 changes: 37 additions & 0 deletions indexer.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM rust:latest as chef
RUN cargo install cargo-chef --locked
WORKDIR /src

FROM chef as planner
COPY ./src/rust/ .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
RUN apt-get update && apt-get install build-essential libclang-dev lld -y
COPY --from=planner /src/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY ./src/rust .
WORKDIR /src/dependencies/aptos-core/aptos-node
RUN cargo build --release --features indexer
RUN strip -s /src/dependencies/aptos-core/target/release/aptos-node

FROM debian:bullseye-slim as runner
COPY --from=builder /src/dependencies/aptos-core/target/release/aptos-node /node/
COPY --from=builder /src/dependencies/aptos-core/aptos-node/indexer-node.yaml /node/
WORKDIR /node
RUN apt-get update && apt-get install libpq-dev curl -y && rm -rf /var/lib/apt/lists/*
ENV APTOS_NETWORK=devnet
ENV DATABASE_URL=postgres://postgres:mysecretpassword@localhost:5432/postgres
ENV REDIS_URL=redis://localhost:6379
ENV ECONIA_ADDRESS=0x000000
ENTRYPOINT [ \
"/bin/bash", \
"-c", \
" \
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/${APTOS_NETWORK}/genesis.blob; \
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/${APTOS_NETWORK}/waypoint.txt; \
sed -i -e \"s|postgres_uri:.*|postgres_uri: \"${DATABASE_URL}\"|g\" indexer-node.yaml; \
./aptos-node --config indexer-node.yaml \
" \
]

2 changes: 1 addition & 1 deletion src/rust/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

2 changes: 1 addition & 1 deletion src/rust/dependencies/aptos-core
Submodule aptos-core updated 967 files

1 comment on commit 1e73a99

@vercel
Copy link

@vercel vercel bot commented on 1e73a99 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.