Dockerfile49 lines · 1187 chars # Multi-stage Dockerfile to build rest_rpc from source and provide a runnable container
# Build stage
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
openssl \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
WORKDIR /workspace
COPY . /workspace
# Configure and build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_SSL=OFF -S . -B build
RUN cmake --build build -j$(nproc)
# Runtime stage
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libgcc1 \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/rest_rpc
# Copy the built artifacts from the builder
COPY --from=builder /workspace/build /opt/rest_rpc/build
# Ensure there is at least one artifact for the smoke test to detect
RUN bash -lc 'printf "artifact_marker" > /opt/rest_rpc/build/.artifact'
# Optional: expose a default command that keeps the container alive for inspection
CMD ["bash", "-lc", "tail -f /dev/null"]