mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Compare commits
3 Commits
239ee5f8e8
...
8cebe6db10
| Author | SHA1 | Date | |
|---|---|---|---|
| 8cebe6db10 | |||
| 78b9028ded | |||
| dd455d3a41 |
56
Dockerfile
Normal file
56
Dockerfile
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# syntax=docker.io/docker/dockerfile:1.7-labs
|
||||||
|
|
||||||
|
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
|
||||||
|
WORKDIR /app
|
||||||
|
LABEL org.opencontainers.image.source=https://github.com/hl-archive-node/nanoreth
|
||||||
|
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
|
||||||
|
|
||||||
|
# Builds a cargo-chef plan
|
||||||
|
FROM chef AS planner
|
||||||
|
COPY --exclude=.git --exclude=dist . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
|
|
||||||
|
# Build profile, release by default
|
||||||
|
ARG BUILD_PROFILE=release
|
||||||
|
ENV BUILD_PROFILE=$BUILD_PROFILE
|
||||||
|
|
||||||
|
# Extra Cargo flags
|
||||||
|
ARG RUSTFLAGS=""
|
||||||
|
ENV RUSTFLAGS="$RUSTFLAGS"
|
||||||
|
|
||||||
|
# Extra Cargo features
|
||||||
|
ARG FEATURES=""
|
||||||
|
ENV FEATURES=$FEATURES
|
||||||
|
|
||||||
|
# Builds dependencies
|
||||||
|
RUN cargo chef cook --profile $BUILD_PROFILE --features "$FEATURES" --recipe-path recipe.json
|
||||||
|
|
||||||
|
# Build application
|
||||||
|
COPY --exclude=dist . .
|
||||||
|
RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin reth-hl
|
||||||
|
|
||||||
|
# ARG is not resolved in COPY so we have to hack around it by copying the
|
||||||
|
# binary to a temporary location
|
||||||
|
RUN cp /app/target/$BUILD_PROFILE/reth-hl /app/reth-hl
|
||||||
|
|
||||||
|
# Use Ubuntu as the release image
|
||||||
|
FROM ubuntu AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install root certificates for aws sdk to work
|
||||||
|
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
|
||||||
|
|
||||||
|
# Copy reth over from the build stage
|
||||||
|
COPY --from=builder /app/reth-hl /usr/local/bin
|
||||||
|
|
||||||
|
# Copy licenses
|
||||||
|
COPY LICENSE-* ./
|
||||||
|
|
||||||
|
EXPOSE 9001 8545 8546
|
||||||
|
ENTRYPOINT ["/usr/local/bin/reth-hl"]
|
||||||
Reference in New Issue
Block a user