diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8f7b9e..001ccfc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,9 @@ permissions: id-token: write contents: read +env: + nightly: nightly-2024-05-15 + jobs: validate-swagger: runs-on: ubuntu-latest @@ -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 @@ -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 @@ -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: @@ -99,6 +105,7 @@ jobs: [ { image: chain, context: chain }, { image: webserver, context: webserver }, + { image: block-index-builder, context: block-index }, ] steps: diff --git a/block-index/Dockerfile b/block-index/Dockerfile new file mode 100644 index 0000000..2695026 --- /dev/null +++ b/block-index/Dockerfile @@ -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"] \ No newline at end of file