Skip to content
Merged
Show file tree
Hide file tree
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
33 changes: 0 additions & 33 deletions docker/Dockerfile.node

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile.prover

This file was deleted.

33 changes: 0 additions & 33 deletions docker/Dockerfile.sequencer

This file was deleted.

73 changes: 73 additions & 0 deletions docker/Dockerfile.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM rust:1.90 AS chef

RUN apt-get update && apt-get install -y \
build-essential \
libclang-dev \
libc6 \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef

WORKDIR /mojave

# --- Planner Stage ---
# Copy all source code to calculate the dependency recipe.
# This layer is fast and will be invalidated on any source change.
FROM chef AS planner

COPY assets ./assets
COPY cmd ./cmd
COPY data ./data
COPY crates ./crates
COPY Cargo.* .

RUN cargo chef prepare --recipe-path recipe.json

# --- Builder Stage ---
# Build the dependencies. This is the most time-consuming step.
# This layer will be cached and only re-run if the recipe.json from the
# previous stage has changed, which only happens when dependencies change.
FROM chef AS builder

COPY --from=planner /mojave/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

RUN curl -L -o /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.29/solc-static-linux \
&& chmod +x /usr/bin/solc

COPY assets ./assets
COPY docs ./docs
COPY cmd ./cmd
COPY data ./data
COPY crates ./crates
COPY Cargo.* .

# Optional build flags
ARG BUILD_FLAGS=""
ARG TARGET_BIN=""
ENV COMPILE_CONTRACTS=true
RUN cargo build --bin $TARGET_BIN --release $BUILD_FLAGS

# --- Final Image ---
# Copy the mojave binary into a minimalist image to reduce bloat size.
# This image must have glibc and libssl
FROM ubuntu:24.04
WORKDIR /usr/local/bin

RUN apt-get update && apt-get install -y --no-install-recommends libssl3

COPY data /data

ARG TARGET_BIN=""
ENV TARGET_BIN=$TARGET_BIN
COPY --from=builder /mojave/target/release/$TARGET_BIN mojave

EXPOSE 8545
EXPOSE 8551
EXPOSE 30303
EXPOSE 9090
EXPOSE 1739


ENTRYPOINT ["mojave"]
12 changes: 6 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,21 @@ doc:
doc-watch:
cargo watch -x "doc --no-deps"

image-prefix := "1sixtech"
registry := "ghcr.io/1sixtech"

# Build the docker image for a specific binary
# Binary name should be one of: mojave-node, mojave-sequencer, mojave-prover
docker-build bin:
docker-build bin registry=registry:
role="{{bin}}"; \
role="${role#mojave-}"; \
docker build \
-f "docker/Dockerfile.$role" \
-t "{{image-prefix}}/{{bin}}" \
docker build --platform=linux/amd64,linux/arm64 \
-f "docker/Dockerfile.target" \
-t "{{registry}}/{{bin}}" \
--build-arg "TARGET_BIN={{bin}}" \
.

docker-run bin *ARGS:
docker run -p 8545:8545 -p 1739:1739 -p 30304:30304 "{{image-prefix}}/{{bin}}" {{ARGS}}
docker run -p 8545:8545 -p 1739:1739 -p 30304:30304 "{{registry}}/{{bin}}" {{ARGS}}

test: clean
bash tests/tests-e2e.sh
Loading