# syntax=docker/dockerfile:1 ARG GO_VERSION=1.20.14 FROM golang:${GO_VERSION}-bullseye AS build-base ENV PATH="${PATH}:/root/.cargo/bin/" # Install GMP 6.3 RUN apt-get update && apt-get install -y \ libgmp-dev \ && rm -rf /var/lib/apt/lists/* # Install Rust toolchain RUN rustup-init -y --profile minimal # Install uniffi-bindgen-go RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 FROM base as build-node WORKDIR /opt/ceremonyclient COPY . . # Generate Rust bindings for VDF WORKDIR /opt/ceremonyclient/vdf RUN go generate # Download node Go dependencies WORKDIR /opt/ceremonyclient/node RUN --mount=type=cache,target=/go/pkg/mod/ \ --mount=type=bind,source=./node/go.sum,target=go.sum \ --mount=type=bind,source=./node/go.mod,target=go.mod \ go mod download -x # Build node Go dependencies RUN --mount=type=cache,target=/go/pkg/mod/ \ --mount=type=bind,target=. \ go build -o /bin/node ./cmd/node FROM scratch AS node COPY --from=build-node /bin/node /bin/ ENTRYPOINT [ "/bin/node" ]