forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfileOp
More file actions
80 lines (60 loc) · 2.21 KB
/
DockerfileOp
File metadata and controls
80 lines (60 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
LABEL org.opencontainers.image.source=https://github.com/paradigmxyz/reth
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
RUN apt-get update && apt-get -y upgrade && \
apt-get install -y libclang-dev pkg-config llvm llvm-dev clang
# ============================================================
# Stage 1: cargo-chef planner
# ============================================================
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ============================================================
# Stage 2: cargo-chef builder
# ============================================================
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
ARG BUILD_PROFILE=maxperf
ENV BUILD_PROFILE=$BUILD_PROFILE
ARG FEATURES=""
ENV FEATURES=$FEATURES
ARG RUSTFLAGS=""
ENV RUSTFLAGS="$RUSTFLAGS"
ARG CARGO_INCREMENTAL=""
ENV CARGO_INCREMENTAL="$CARGO_INCREMENTAL"
ARG LLVM_PROFILE_FILE=""
ENV LLVM_PROFILE_FILE="$LLVM_PROFILE_FILE"
# Build deps with cargo-chef
RUN cargo chef cook \
--profile $BUILD_PROFILE \
--features "$FEATURES" \
--recipe-path recipe.json \
--manifest-path /app/crates/optimism/bin/op-reth/Cargo.toml
# Build op-reth
COPY . .
RUN cargo build \
--profile $BUILD_PROFILE \
--features "$FEATURES" \
--bin op-reth \
--manifest-path /app/crates/optimism/bin/op-reth/Cargo.toml
# Copy resulting binary
RUN ls -la /app/target/$BUILD_PROFILE/op-reth
RUN cp /app/target/$BUILD_PROFILE/op-reth /app/op-reth
# ============================================================
# Stage 3: runtime container
# ============================================================
FROM ubuntu AS runtime
RUN apt-get update && \
apt-get install -y ca-certificates libssl-dev pkg-config strace llvm && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy op-reth binary
COPY --from=builder /app/op-reth /usr/local/bin/
RUN chmod +x /usr/local/bin/op-reth
COPY LICENSE-* ./
# Coverage output directory
ENV LLVM_PROFILE_FILE="/coverage/%m-%p.profraw"
RUN mkdir -p /coverage
EXPOSE 30303 30303/udp 9001 8545 8546 7545 8551
ENTRYPOINT ["/usr/local/bin/op-reth"]