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

Fix and simplify hive dockerfile #484

Merged
merged 1 commit into from
May 3, 2024
Merged
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
40 changes: 8 additions & 32 deletions hive/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
FROM rust:latest AS runtime
WORKDIR /app

# Builds a cargo-chef plan
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

# Install system dependencies
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config && apt-get install protobuf-compiler -y
RUN apt-get update && apt-get -y upgrade && \
apt-get install -y libclang-dev pkg-config && \
apt-get install protobuf-compiler -y && apt-get install -y curl && \
apt-get install cmake -y

# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .

# Install risczero
RUN cargo install cargo-binstall && cargo binstall cargo-risczero -y && cargo risczero install --version v2024-04-22.0

# Build the project
RUN cargo build --release --bin citrea
RUN SKIP_GUEST_BUILD=1 cargo build --release --bin citrea

# We need cargo to run the binary because of some path finding dependencies
FROM rust:latest AS runtime
WORKDIR /app

# Install curl
RUN apt-get update && \
apt-get install -y curl

# Copying the directory except the target directory
COPY --from=builder /app /app

# Copy the binary from the builder stage
COPY --from=builder /app/target/release/citrea /app/bin/citrea

RUN cargo

EXPOSE 8545

WORKDIR /app/bin/citrea
ENTRYPOINT ["sh", "-c", "./publish_da_block.sh & ./citrea --genesis-paths ../../hive/genesis --rollup-config-path configs/mock-dockerized/rollup_config.toml --sequencer-config-path configs/mock-dockerized/sequencer_config.toml"]

ENTRYPOINT ["sh", "-c", "./bin/citrea/publish_da_block.sh & ./target/release/citrea --genesis-paths ./hive/genesis --rollup-config-path ./bin/citrea/configs/mock-dockerized/rollup_config.toml --sequencer-config-path ./bin/citrea/configs/mock-dockerized/sequencer_config.toml"]
Loading