From 249f8b5c55566e512f90b4835e559da227c5c96a Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:59:43 +0100 Subject: [PATCH] fix(docker): rm fails --- Dockerfile | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5039a062b69..e20d1a53a0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -145,6 +145,19 @@ ENV CARGO_INCREMENTAL=${CARGO_INCREMENTAL} ARG AWS_ACCESS_KEY_ID ARG AWS_SECRET_ACCESS_KEY +# +# BUILD ROCKSDB STATIC LIBRARY +# +FROM deps-${RUSTC_WRAPPER:-base} AS rocksdb + +RUN mkdir -p /tmp/rocksdb +WORKDIR /tmp/rocksdb +RUN git clone https://github.com/facebook/rocksdb.git -b v8.10.2 --depth 1 . && \ + make static_lib && \ + make DESTDIR=/opt/rocksdb install-static && \ + cd / && \ + rm -rf /tmp/rocksdb + # # DEPS: FULL DEPENDENCIES LIST # @@ -154,6 +167,14 @@ FROM deps-${RUSTC_WRAPPER:-base} AS deps ARG SCCACHE_S3_KEY_PREFIX ENV SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX}/${TARGETARCH}/linux-musl +# Install prebuilt rocksdb library + +COPY --from=rocksdb /opt/rocksdb /opt/rocksdb +# Set env variables so that Rust's rocksdb-sys will not build rocksdb from scratch + +ENV ROCKSDB_STATIC=/opt/rocksdb/usr/local/lib/librocksdb.a +ENV ROCKSDB_LIB_DIR=/opt/rocksdb/usr/local/lib + WORKDIR /platform # Install wasm-bindgen-cli in the same profile as other components, to sacrifice some performance & disk space to gain @@ -171,12 +192,17 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM # Meanwhile if you want to update wasm-bindgen you also need to update version in: # - packages/wasm-dpp/Cargo.toml # - packages/wasm-dpp/scripts/build-wasm.sh - cargo install --profile "$CARGO_BUILD_PROFILE" wasm-bindgen-cli@0.2.86 cargo-chef@0.1.67 --locked + cargo install --profile "$CARGO_BUILD_PROFILE" wasm-bindgen-cli@0.2.86 cargo-chef@0.1.67 --locked + # # Rust build planner to speed up builds # FROM deps AS build-planner + +ENV ROCKSDB_STATIC=/opt/rocksdb/usr/local/lib/librocksdb.a +ENV ROCKSDB_LIB_DIR=/opt/rocksdb/usr/local/lib + WORKDIR /platform COPY . . RUN source $HOME/.cargo/env && \ @@ -196,6 +222,9 @@ SHELL ["/bin/bash", "-o", "pipefail","-e", "-x", "-c"] ARG SCCACHE_S3_KEY_PREFIX ENV SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX}/${TARGETARCH}/linux-musl +ENV ROCKSDB_STATIC=/opt/rocksdb/usr/local/lib/librocksdb.a +ENV ROCKSDB_LIB_DIR=/opt/rocksdb/usr/local/lib + WORKDIR /platform COPY --from=build-planner /platform/recipe.json recipe.json @@ -251,6 +280,9 @@ FROM deps AS build-js ARG SCCACHE_S3_KEY_PREFIX ENV SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX}/wasm/wasm32 +ENV ROCKSDB_STATIC=/opt/rocksdb/usr/local/lib/librocksdb.a +ENV ROCKSDB_LIB_DIR=/opt/rocksdb/usr/local/lib + WORKDIR /platform COPY --from=build-planner /platform/recipe.json recipe.json