Skip to content

Commit

Permalink
Merge pull request #12 from anoma/fraccaman/block-indexer-ci
Browse files Browse the repository at this point in the history
ci: block-index-builder
  • Loading branch information
Fraccaman authored Jul 28, 2024
2 parents 6645315 + 3155153 commit 2f51a5c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ permissions:
id-token: write
contents: read

env:
nightly: nightly-2024-05-15

jobs:
validate-swagger:
runs-on: ubuntu-latest
Expand All @@ -37,13 +40,14 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- uses: rui314/setup-mold@v1
- uses: heliaxdev/setup-protoc@v2
- name: Install protobuf
uses: arduino/setup-protoc@v3
with:
version: "25.0"
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-05-15
toolchain: ${{ env.nightly }}
components: clippy
cache: true
- run: just clippy
Expand All @@ -56,13 +60,14 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- uses: rui314/setup-mold@v1
- uses: heliaxdev/setup-protoc@v2
- name: Install protobuf
uses: arduino/setup-protoc@v3
with:
version: "25.0"
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-05-15
toolchain: ${{ env.nightly }}
components: rustfmt
cache: true
- run: just fmt check
Expand All @@ -75,9 +80,10 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- uses: rui314/setup-mold@v1
- uses: heliaxdev/setup-protoc@v2
- name: Install protobuf
uses: arduino/setup-protoc@v3
with:
version: "25.0"
version: "25.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -99,6 +105,7 @@ jobs:
[
{ image: chain, context: chain },
{ image: webserver, context: webserver },
{ image: block-index-builder, context: block-index },
]

steps:
Expand Down
26 changes: 26 additions & 0 deletions block-index/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.78-bookworm AS chef
WORKDIR /app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json

RUN apt-get update && apt-get install -y protobuf-compiler build-essential clang-tools-14

RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN cargo build --release --package block-index

FROM debian:bookworm-slim AS runtime
WORKDIR /app
COPY --from=builder /app/target/release/block-index-builder /app/block-index-builder

RUN apt-get update && apt-get install -y libpq5

WORKDIR /app

CMD ["./block-index-builder"]

0 comments on commit 2f51a5c

Please sign in to comment.