The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/rust/Dockerfile

54 lines
1.5 KiB

# syntax=docker/dockerfile:experimental
FROM rust:1.60 as builder
WORKDIR /usr/src
# 1a: Prepare for static linking
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y musl-tools clang && \
rustup target add x86_64-unknown-linux-musl
# Add workspace to workdir
COPY agents ./agents
COPY chains ./chains
COPY abacus-base ./abacus-base
COPY abacus-cli ./abacus-cli
COPY abacus-core ./abacus-core
COPY abacus-test ./abacus-test
COPY Cargo.toml .
COPY Cargo.lock .
# Build binaries
RUN \
--mount=id=cargo,type=cache,sharing=locked,target=/usr/src/target \
--mount=id=cargo-home-registry,type=cache,sharing=locked,target=/usr/local/cargo/registry \
--mount=id=cargo-home-git,type=cache,sharing=locked,target=/usr/local/cargo/git \
cargo build --release --no-default-features --features oneline-errors && \
mkdir -p /release && \
cp /usr/src/target/release/validator /release && \
cp /usr/src/target/release/relayer /release && \
cp /usr/src/target/release/kathy /release && \
cp /usr/src/target/release/abacus-cli /release
## 2: Copy the binaries to release image
FROM ubuntu:20.04
RUN apt-get update && \
apt-get install -y \
openssl \
ca-certificates \
tini && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY config ./config
COPY --from=builder /release/* .
RUN chmod 777 /app && \
mkdir /usr/share/abacus/ && \
chmod 1000 /usr/share/abacus
USER 1000
ENTRYPOINT ["tini", "--"]
CMD ["./validator"]