-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile.test
More file actions
52 lines (41 loc) · 1.76 KB
/
Dockerfile.test
File metadata and controls
52 lines (41 loc) · 1.76 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
FROM rust:1.88.0 AS chef
ARG CARGO_FEATURES=""
# Install basic packages
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
RUN cargo install cargo-chef --locked
FROM chef AS planner
WORKDIR /app
COPY . .
# Hacky: Replace tests with dummy stub to avoid workspace member issues of top-level Cargo.toml.
# This is needed because within the Docker integration tests we don't need the tests crate
# and want to avoid rebuilding it on every change.
RUN mkdir -p tests/src && \
echo '[package]' > tests/Cargo.toml && \
echo 'name = "tests"' >> tests/Cargo.toml && \
echo 'version = "0.0.1"' >> tests/Cargo.toml && \
echo 'edition = "2021"' >> tests/Cargo.toml && \
echo '' >> tests/Cargo.toml && \
echo '[lib]' >> tests/Cargo.toml && \
echo 'name = "tests"' >> tests/Cargo.toml && \
echo 'path = "src/lib.rs"' >> tests/Cargo.toml && \
echo 'pub fn dummy() {}' > tests/src/lib.rs
RUN cargo chef prepare --recipe-path /recipe.json
FROM chef AS builder
WORKDIR /app
COPY --from=planner /recipe.json recipe.json
COPY .cargo /app/.cargo
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo build ${CARGO_FEATURES:+--features $CARGO_FEATURES} --release --target-dir=/app-target
# Release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl sqlite3 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app-target/release/rollup-node /bin/
EXPOSE 30303 30303/udp 9001 8545 8546 6669
ENTRYPOINT ["rollup-node"]