2023-07-26 03:06:01 -04:00
|
|
|
FROM rust:1.71-slim-bookworm as builder
|
2022-09-12 15:01:14 -05:00
|
|
|
LABEL description="STAGE 1: Build"
|
|
|
|
|
|
|
|
|
|
# Add files for build
|
2022-11-11 02:20:10 -05:00
|
|
|
ADD common /serai/common
|
2022-09-12 15:01:14 -05:00
|
|
|
ADD crypto /serai/crypto
|
2022-11-11 02:20:10 -05:00
|
|
|
ADD coins /serai/coins
|
2023-07-19 19:22:49 -04:00
|
|
|
ADD message-queue /serai/message-queue
|
2022-11-11 02:20:10 -05:00
|
|
|
ADD processor /serai/processor
|
2023-05-08 02:08:31 -04:00
|
|
|
ADD coordinator /serai/coordinator
|
2022-11-11 02:20:10 -05:00
|
|
|
ADD substrate /serai/substrate
|
2023-05-08 02:08:31 -04:00
|
|
|
ADD tests /serai/tests
|
2022-09-12 15:01:14 -05:00
|
|
|
ADD Cargo.toml /serai
|
2022-11-11 02:20:10 -05:00
|
|
|
ADD Cargo.lock /serai
|
2022-09-12 15:01:14 -05:00
|
|
|
ADD AGPL-3.0 /serai
|
|
|
|
|
|
|
|
|
|
WORKDIR /serai
|
|
|
|
|
|
2023-07-26 03:06:01 -04:00
|
|
|
RUN apt update && apt upgrade -y && apt install -y make clang libssl-dev protobuf-compiler
|
|
|
|
|
|
|
|
|
|
# Add the wasm toolchain
|
|
|
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
|
|
|
|
|
|
|
|
# Mount the caches and build
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cargo \
|
2022-12-08 22:10:12 -05:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
2023-07-26 03:06:01 -04:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
2023-07-22 01:12:39 -04:00
|
|
|
--mount=type=cache,target=/serai/target \
|
2023-07-19 20:13:16 -04:00
|
|
|
cd substrate/node && cargo build --release
|
2022-09-12 15:01:14 -05:00
|
|
|
|
|
|
|
|
# Prepare Image
|
2023-07-26 03:06:01 -04:00
|
|
|
FROM debian:bookworm-slim as image
|
2022-09-12 15:01:14 -05:00
|
|
|
LABEL description="STAGE 2: Copy and Run"
|
|
|
|
|
|
|
|
|
|
WORKDIR /home/serai
|
|
|
|
|
|
|
|
|
|
# Copy necessary files to run node
|
2022-10-24 23:48:11 -05:00
|
|
|
COPY --from=builder /serai/target/release/ /bin/
|
2022-09-12 15:01:14 -05:00
|
|
|
COPY --from=builder /serai/AGPL-3.0 .
|
|
|
|
|
|
2023-07-26 03:06:01 -04:00
|
|
|
# Upgrade packages
|
|
|
|
|
RUN apt update && apt upgrade -y
|
|
|
|
|
|
2022-09-12 15:01:14 -05:00
|
|
|
# Run node
|
|
|
|
|
EXPOSE 30333 9615 9933 9944
|
|
|
|
|
CMD ["serai-node"]
|