From 92f15ae212e673fc2e8e6273b81a14c66196f7dd Mon Sep 17 00:00:00 2001 From: Barry Botha Date: Thu, 11 Jul 2024 14:58:41 +0300 Subject: [PATCH 1/4] chore: added libs for building diff function code --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0288d566..301a4db7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM rust:1.76.0-slim-bullseye AS chef +FROM rust:1.79.0-slim-bullseye AS chef -RUN apt-get update && apt-get -y --no-install-recommends install git build-essential m4 llvm libclang-dev diffutils curl +RUN apt-get update && apt-get -y --no-install-recommends install git build-essential m4 llvm libclang-dev diffutils curl cmake libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev python3 RUN cargo install cargo-chef WORKDIR /aiblock ENV CARGO_TARGET_DIR=/aiblock From 9e50318410038b38f751e4e907440f683bab3fd0 Mon Sep 17 00:00:00 2001 From: Barry Botha Date: Mon, 15 Jul 2024 09:15:57 +0300 Subject: [PATCH 2/4] chore: new code is not building on arm64 --- .github/workflows/node-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node-build.yml b/.github/workflows/node-build.yml index 13b2b12a..5c346725 100644 --- a/.github/workflows/node-build.yml +++ b/.github/workflows/node-build.yml @@ -23,7 +23,7 @@ jobs: matrix: platform: - linux/amd64 - - linux/arm64 + #- linux/arm64 steps: - name: Prepare run: | From 807665c61a450a89c6547d092db1bd0209ee8522 Mon Sep 17 00:00:00 2001 From: Barry Botha Date: Mon, 15 Jul 2024 09:16:31 +0300 Subject: [PATCH 3/4] chore: test with simplified build --- Dockerfile | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 301a4db7..dfddf4f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,28 @@ FROM rust:1.79.0-slim-bullseye AS chef RUN apt-get update && apt-get -y --no-install-recommends install git build-essential m4 llvm libclang-dev diffutils curl cmake libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev python3 -RUN cargo install cargo-chef +#RUN cargo install cargo-chef WORKDIR /aiblock ENV CARGO_TARGET_DIR=/aiblock -FROM chef AS planner - -COPY . . -RUN cargo chef prepare --recipe-path recipe.json - -FROM chef AS builder -COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json -RUN cargo chef cook --release --recipe-path /aiblock/recipe.json COPY . . RUN cargo build --release +# FROM chef AS planner -# Use distroless -FROM cgr.dev/chainguard/glibc-dynamic:latest +# COPY . . +# RUN cargo chef prepare --recipe-path recipe.json -# COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh +# FROM chef AS builder +# COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json +# RUN cargo chef cook --release --recipe-path /aiblock/recipe.json +# COPY . . +# RUN cargo build --release -USER nonroot +# Use distroless +#FROM cgr.dev/chainguard/glibc-dynamic:latest +# + +#USER nonroot # Set these in the environment to override [use once we have env vars available] ARG NODE_TYPE_ARG="mempool" @@ -35,15 +36,15 @@ ENV API_USE_TLS="0" ENV MEMPOOL_MINER_WHITELIST="/etc/mempool_miner_whitelist.json" ENV RUST_LOG=info,debug -# RUN echo "Node type is $NODE_TYPE" - # Copy node bin -COPY --from=builder /aiblock/release/node ./node +#COPY --from=builder /aiblock/release/node /aiblock/node +#COPY --from=builder /usr/lib/x86_64-linux-gnu/libX11.so.6 /usr/lib/x86_64-linux-gnu/libX11.so.6 +RUN cp /aiblock/release/node /aiblock/node # Default config for the node COPY .docker/conf/* /etc/. -ENTRYPOINT ["./node"] +ENTRYPOINT ["/aiblock/node"] CMD [$NODE_TYPE] From 379b062d381301e17a774e3d38c956c48aa75b2c Mon Sep 17 00:00:00 2001 From: Barry Botha Date: Wed, 17 Jul 2024 11:56:20 +0300 Subject: [PATCH 4/4] chore: test working non-distroless build --- Dockerfile | 29 ++++++++++++++--------------- docker-compose.yml | 3 +++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index dfddf4f2..4d2b8bed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,26 @@ FROM rust:1.79.0-slim-bullseye AS chef RUN apt-get update && apt-get -y --no-install-recommends install git build-essential m4 llvm libclang-dev diffutils curl cmake libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev python3 -#RUN cargo install cargo-chef +RUN cargo install cargo-chef WORKDIR /aiblock ENV CARGO_TARGET_DIR=/aiblock -COPY . . -RUN cargo build --release -# FROM chef AS planner +FROM chef AS planner -# COPY . . -# RUN cargo chef prepare --recipe-path recipe.json +COPY . . +RUN cargo chef prepare --recipe-path recipe.json -# FROM chef AS builder -# COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json -# RUN cargo chef cook --release --recipe-path /aiblock/recipe.json -# COPY . . -# RUN cargo build --release +FROM chef AS builder +COPY --from=planner /aiblock/recipe.json /aiblock/recipe.json +RUN cargo chef cook --release --recipe-path /aiblock/recipe.json +COPY . . +RUN cargo build --release # Use distroless #FROM cgr.dev/chainguard/glibc-dynamic:latest # - +FROM rust:1.79.0-slim-bullseye +RUN apt-get update && apt-get -y --no-install-recommends install libclang-dev libxinerama-dev #USER nonroot # Set these in the environment to override [use once we have env vars available] @@ -37,14 +36,14 @@ ENV MEMPOOL_MINER_WHITELIST="/etc/mempool_miner_whitelist.json" ENV RUST_LOG=info,debug # Copy node bin -#COPY --from=builder /aiblock/release/node /aiblock/node +COPY --from=builder /aiblock/release/node /aiblock/aiblock #COPY --from=builder /usr/lib/x86_64-linux-gnu/libX11.so.6 /usr/lib/x86_64-linux-gnu/libX11.so.6 -RUN cp /aiblock/release/node /aiblock/node +#RUN cp /aiblock/release/node /aiblock/aiblock # Default config for the node COPY .docker/conf/* /etc/. -ENTRYPOINT ["/aiblock/node"] +ENTRYPOINT ["/aiblock/aiblock"] CMD [$NODE_TYPE] diff --git a/docker-compose.yml b/docker-compose.yml index 73fcdafb..ed6f5801 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: volumes: - /tmp/mempool:/src command: mempool + platform: linux/amd64 networks: aiblock: ipv4_address: 172.28.0.3 @@ -32,6 +33,8 @@ services: miner-node: <<: *node-default + environment: + RUST_LOG: trace depends_on: - mempool-node - storage-node