Files
serai/deploy/serai/Dockerfile

47 lines
1.2 KiB
Docker
Raw Normal View History

FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Add files for build
2022-11-11 02:20:10 -05:00
ADD common /serai/common
ADD crypto /serai/crypto
2022-11-11 02:20:10 -05:00
ADD coins /serai/coins
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
ADD Cargo.toml /serai
2022-11-11 02:20:10 -05:00
ADD Cargo.lock /serai
ADD AGPL-3.0 /serai
WORKDIR /serai
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 \
--mount=type=cache,target=/usr/local/cargo/git \
2023-07-22 01:12:39 -04:00
--mount=type=cache,target=/serai/target \
cd substrate/node && cargo build --release
# Prepare Image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"
WORKDIR /home/serai
# Copy necessary files to run node
COPY --from=builder /serai/target/release/ /bin/
COPY --from=builder /serai/AGPL-3.0 .
# Upgrade packages
RUN apt update && apt upgrade -y
# Run node
EXPOSE 30333 9615 9933 9944
CMD ["serai-node"]