Skip to content

Commit

Permalink
Disable caching dockerfile (MystenLabs#10439)
Browse files Browse the repository at this point in the history
## Description 

This disables caching in docker, which
* allows for the new external-crates
* actually speeds up builds because it caching being leveraged.

Tested on
https://github.com/MystenLabs/sui-operations/actions/runs/4620909699

## Test Plan 


---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
oxade authored Apr 5, 2023
1 parent 024209a commit e95b596
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 36 deletions.
19 changes: 10 additions & 9 deletions crates/sui-rosetta/docker/sui-rosetta-local/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ ENV PATH="/root/.cargo/bin:${PATH}"
# crate, from the workspace Cargo.toml file.
# 3. Update the lockfile in order to reflect the changes to the
# root Cargo.toml file.
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates/workspace-hack crates/workspace-hack
RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
&& cargo metadata -q >/dev/null
# FROM chef AS planner
# COPY Cargo.toml Cargo.lock ./
# COPY crates/workspace-hack crates/workspace-hack
# RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
# && cargo metadata -q >/dev/null

# Build and cache all dependencies.
#
# In a fresh layer, copy in the "plan" generated by the planner
# and run `cargo build` in order to create a caching Docker layer
# with all dependencies built.
FROM chef AS builder
COPY --from=planner /sui/Cargo.toml Cargo.toml
COPY --from=planner /sui/Cargo.lock Cargo.lock
COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
RUN cargo build --release
# COPY --from=planner /sui/Cargo.toml Cargo.toml
# COPY --from=planner /sui/Cargo.lock Cargo.lock
# COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
# RUN cargo build --release
RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s

# Build application
Expand All @@ -40,6 +40,7 @@ RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scr
COPY Cargo.toml Cargo.lock ./
COPY crates crates
COPY narwhal narwhal
COPY external-crates external-crates
RUN cargo build --release --bin sui --bin sui-rosetta

# Production Image
Expand Down
19 changes: 10 additions & 9 deletions docker/sui-indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ RUN apt-get update && apt-get install -y cmake clang
# crate, from the workspace Cargo.toml file.
# 3. Update the lockfile in order to reflect the changes to the
# root Cargo.toml file.
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates/workspace-hack crates/workspace-hack
RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
&& cargo metadata -q >/dev/null
# FROM chef AS planner
# COPY Cargo.toml Cargo.lock ./
# COPY crates/workspace-hack crates/workspace-hack
# RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
# && cargo metadata -q >/dev/null

# Build and cache all dependencies.
#
# In a fresh layer, copy in the "plan" generated by the planner
# and run `cargo build` in order to create a caching Docker layer
# with all dependencies built.
FROM chef AS builder
COPY --from=planner /sui/Cargo.toml Cargo.toml
COPY --from=planner /sui/Cargo.lock Cargo.lock
COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
RUN cargo build --release
# COPY --from=planner /sui/Cargo.toml Cargo.toml
# COPY --from=planner /sui/Cargo.lock Cargo.lock
# COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
# RUN cargo build --release

# Build application
#
Expand All @@ -37,6 +37,7 @@ RUN cargo build --release
COPY Cargo.toml Cargo.lock ./
COPY crates crates
COPY narwhal narwhal
COPY external-crates external-crates
RUN cargo build --release \
--bin sui-indexer

Expand Down
21 changes: 12 additions & 9 deletions docker/sui-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG PROFILE=release
WORKDIR sui
RUN apt-get update && apt-get install -y cmake clang

# For now disable caching

# Plan out the 3rd-party dependencies that need to be built.
#
# This is done by:
Expand All @@ -11,11 +13,11 @@ RUN apt-get update && apt-get install -y cmake clang
# crate, from the workspace Cargo.toml file.
# 3. Update the lockfile in order to reflect the changes to the
# root Cargo.toml file.
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates/workspace-hack crates/workspace-hack
RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
&& cargo metadata -q >/dev/null
# FROM chef AS planner
# COPY Cargo.toml Cargo.lock ./
# COPY crates/workspace-hack crates/workspace-hack
# RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
# && cargo metadata -q >/dev/null

# Build and cache all dependencies.
#
Expand All @@ -24,10 +26,10 @@ RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
# with all dependencies built.
FROM chef AS builder
ARG PROFILE=release
COPY --from=planner /sui/Cargo.toml Cargo.toml
COPY --from=planner /sui/Cargo.lock Cargo.lock
COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
RUN cargo build --profile $PROFILE
# COPY --from=planner /sui/Cargo.toml Cargo.toml
# COPY --from=planner /sui/Cargo.lock Cargo.lock
# COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
# RUN cargo build --profile $PROFILE

# Build application
#
Expand All @@ -38,6 +40,7 @@ ARG GIT_REVISION
COPY Cargo.toml Cargo.lock ./
COPY crates crates
COPY narwhal narwhal
COPY external-crates external-crates
RUN cargo build --profile $PROFILE --bin sui-node
# RUN apt-get update && apt-get install -y binutils
# RUN strip --debug-only -w -K sui* -K narwhal* -K hyper* -K typed_store* "/sui/target/$PROFILE/sui-node"
Expand Down
19 changes: 10 additions & 9 deletions docker/sui-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ RUN apt-get update && apt-get install -y cmake clang
# crate, from the workspace Cargo.toml file.
# 3. Update the lockfile in order to reflect the changes to the
# root Cargo.toml file.
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates/workspace-hack crates/workspace-hack
RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
&& cargo metadata -q >/dev/null
# FROM chef AS planner
# COPY Cargo.toml Cargo.lock ./
# COPY crates/workspace-hack crates/workspace-hack
# RUN sed -i '/crates\/workspace-hack/b; /crates/d; /narwhal/d' Cargo.toml \
# && cargo metadata -q >/dev/null

# Build and cache all dependencies.
#
# In a fresh layer, copy in the "plan" generated by the planner
# and run `cargo build` in order to create a caching Docker layer
# with all dependencies built.
FROM chef AS builder
COPY --from=planner /sui/Cargo.toml Cargo.toml
COPY --from=planner /sui/Cargo.lock Cargo.lock
COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
RUN cargo build --release
# COPY --from=planner /sui/Cargo.toml Cargo.toml
# COPY --from=planner /sui/Cargo.lock Cargo.lock
# COPY --from=planner /sui/crates/workspace-hack crates/workspace-hack
# RUN cargo build --release

# Build application
#
Expand All @@ -37,6 +37,7 @@ RUN cargo build --release
COPY Cargo.toml Cargo.lock ./
COPY crates crates
COPY narwhal narwhal
COPY external-crates external-crates
RUN cargo build --release \
--bin sui-node \
--bin sui \
Expand Down

0 comments on commit e95b596

Please sign in to comment.