ceremonyclient/Dockerfile.source
Cassandra Heart 65bf136018
sidecar
2025-03-27 03:56:14 -05:00

155 lines
4.2 KiB
Docker

FROM ubuntu:24.04 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 \
build-essential \
curl \
git \
cmake \
libgmp-dev \
libmpfr-dev \
libmpfr6 \
wget \
m4 \
pkg-config \
gcc \
g++ \
make \
autoconf \
automake \
libtool \
libssl-dev \
python3 \
python-is-python3 \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/scripts/install.py
RUN python install.py --install --tool --ot
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
RUN cd emp-ot && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
RUN apt update && apt install -y wget && \
ARCH=$(dpkg --print-architecture) && \
case ${ARCH} in \
amd64) GOARCH=amd64 ;; \
arm64) GOARCH=arm64 ;; \
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
esac && \
wget https://go.dev/dl/go1.22.0.linux-${GOARCH}.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go1.22.0.linux-${GOARCH}.tar.gz && \
rm go1.22.0.linux-${GOARCH}.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
RUN git clone https://github.com/flintlib/flint.git && \
cd flint && \
git checkout flint-3.0 && \
./bootstrap.sh && \
./configure \
--prefix=/usr/local \
--with-gmp=/usr/local \
--with-mpfr=/usr/local \
--enable-static \
--disable-shared \
CFLAGS="-O3" && \
make && \
make install && \
cd .. && \
rm -rf flint
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
WORKDIR /opt/ceremonyclient
COPY . .
WORKDIR /opt/ceremonyclient/ferret
RUN ./generate.sh
## Generate Rust bindings for VDF
WORKDIR /opt/ceremonyclient/vdf
RUN ./generate.sh
## Generate Rust bindings for BLS48581
WORKDIR /opt/ceremonyclient/bls48581
RUN ./generate.sh
## Generate Rust bindings for VerEnc
WORKDIR /opt/ceremonyclient/verenc
RUN ./generate.sh
# Build and install the node
WORKDIR /opt/ceremonyclient/node
RUN ./build.sh && cp node /usr/bin
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
# Build and install qclient
WORKDIR /opt/ceremonyclient/client
RUN ./build.sh -o qclient && cp qclient /usr/bin
# Build and install sidecar
WORKDIR /opt/ceremonyclient/sidecar
RUN ./build.sh -o sidecar ./... && cp sidecar /usr/bin
# Allows exporting single binary
FROM scratch as qclient
COPY --from=build /usr/bin/qclient /qclient
ENTRYPOINT [ "/qclient" ]
# Allows exporting single binary
FROM scratch as sidecar
COPY --from=build /usr/bin/sidecar /sidecar
ENTRYPOINT [ "/sidecar" ]
# Allows exporting single binary
FROM scratch AS node
COPY --from=build /usr/bin/node /node
ENTRYPOINT [ "/node" ]
FROM ubuntu:24.04
RUN apt-get update && apt-get install libflint-dev -y
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 /usr/bin/node /usr/local/bin
COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin
WORKDIR /root
ENTRYPOINT ["node"]