# syntax=docker.io/docker/dockerfile:1.7-labs FROM golang:1.22.4-bullseye AS build-base ENV PATH="${PATH}:/root/.cargo/bin/" # Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) RUN apt-get update && apt-get install -y \ libgmp-dev \ && rm -rf /var/lib/apt/lists/* COPY docker/rustup-init.sh /opt/rustup-init.sh RUN /opt/rustup-init.sh -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 build-base AS build ENV GOEXPERIMENT=arenas ENV QUILIBRIUM_SIGNATURE_CHECK=false ENV GOCACHE=/tmp/.cache/go-build # Install grpcurl before building the node and client # as to avoid needing to redo it on rebuilds RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest WORKDIR /opt/ceremonyclient # Copy everything except node and client so as to avoid # invalidating the cache at this point on client or node rebuilds COPY --exclude=node --exclude=client . . ## Generate Rust bindings for VDF WORKDIR /opt/ceremonyclient/vdf RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/opt/target/ \ ./generate.sh ## Generate Rust bindings for BLS48581 WORKDIR /opt/ceremonyclient/bls48581 RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/opt/target/ \ ./generate.sh COPY ./node /opt/ceremonyclient/node WORKDIR /opt/ceremonyclient/node RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/opt/target/ \ --mount=type=cache,target=/tmp/.cache/go-build \ ./build.sh && cp node /go/bin # Build and install qclient COPY ./client /opt/ceremonyclient/client WORKDIR /opt/ceremonyclient/client RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/opt/target/ \ --mount=type=cache,target=/tmp/.cache/go-build \ ./build.sh -o qclient && cp qclient /go/bin # Allows exporting single binary FROM scratch AS qclient COPY --from=build /go/bin/qclient /qclient ENTRYPOINT [ "/qclient" ] # Allows exporting single binary FROM scratch AS node COPY --from=build /go/bin/node /node ENTRYPOINT [ "/node" ] FROM debian:bullseye ARG NODE_VERSION ARG GIT_REPO ARG GIT_BRANCH ARG GIT_COMMIT ENV GOEXPERIMENT=arenas LABEL org.opencontainers.image.title="Quilibrium Network Node" LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." LABEL org.opencontainers.image.version=$NODE_VERSION LABEL org.opencontainers.image.vendor=Quilibrium LABEL org.opencontainers.image.url=https://quilibrium.com/ LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs LABEL org.opencontainers.image.source=$GIT_REPO LABEL org.opencontainers.image.ref.name=$GIT_BRANCH LABEL org.opencontainers.image.revision=$GIT_COMMIT RUN apt-get update && apt-get install -y ca-certificates COPY --from=build /go/bin/node /usr/local/bin COPY --from=build /go/bin/grpcurl /usr/local/bin COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin WORKDIR /root ENTRYPOINT ["node"]