Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: block-index-builder #12

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]