ccache-ccache
SUCCESS
7m 20s
History Source
SummaryIterations1Transcript5Dockerfile
Dockerfile60 lines · 1255 chars
FROM ubuntu:24.04 AS builder

# Build dependencies
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    asciidoctor \
    bash \
    build-essential \
    ccache \
    clang \
    cmake \
    docbook-xml \
    docbook-xsl \
    elfutils \
    gcc-13 \
    g++-13 \
    g++-14 \
    libhiredis-dev \
    libzstd-dev \
    python3 \
    redis-server \
    redis-tools \
    ninja-build \
 && rm -rf /var/lib/apt/lists/*

# Redirect all compilers to ccache
RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done

WORKDIR /ccache

# Copy source code
COPY . .

# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF
RUN cmake --build build -j$(nproc)
RUN cmake --install build --prefix /install

FROM ubuntu:24.04

# Runtime image: include the built ccache binary
COPY --from=builder /install /install

# Ensure the binary is in PATH
ENV PATH="/install/bin:${PATH}"

WORKDIR /work

# Install runtime dependencies for the built binary
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    libhiredis-dev \
    libzstd1 \
 && rm -rf /var/lib/apt/lists/*

# Default command: show help
CMD ["ccache","--help"]