Skip to content

Commit

Permalink
fix(docker): rm fails
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Nov 6, 2024
1 parent 39eb45c commit 249f8b5
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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
Expand All @@ -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" [email protected] [email protected] --locked
cargo install --profile "$CARGO_BUILD_PROFILE" [email protected] [email protected] --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 && \
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 249f8b5

Please sign in to comment.