This repository has been archived on 2024-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
stagex/cmake/Dockerfile

58 lines
1.6 KiB
Docker
Raw Normal View History

2023-12-10 18:05:50 +00:00
ARG REGISTRY=local
FROM ${REGISTRY}/gcc:latest as gcc
FROM ${REGISTRY}/binutils:latest as binutils
FROM ${REGISTRY}/musl:latest as musl
FROM ${REGISTRY}/curl:latest as curl
FROM ${REGISTRY}/ninja:latest as ninja
FROM ${REGISTRY}/openssl:latest as openssl
FROM ${REGISTRY}/linux-headers:latest as linux-headers
FROM ${REGISTRY}/make:latest as make
2023-12-16 23:50:40 +00:00
FROM ${REGISTRY}/busybox:latest as busybox
2023-11-20 03:29:02 +00:00
2023-12-16 23:50:40 +00:00
FROM busybox as base
2023-11-20 03:29:02 +00:00
ENV SRC_SITE=https://cmake.org/files
ENV SRC_VERSION=3.27.8
ENV SRC_HASH=fece24563f697870fbb982ea8bf17482c9d5f855d8c9bf0b82463d76c9e8d0cc
COPY --from=curl . /
COPY --from=binutils . /
COPY --from=ninja . /
COPY --from=musl . /
COPY --from=make . /
COPY --from=linux-headers . /
COPY --from=gcc . /
2023-12-16 23:50:40 +00:00
FROM base as fetch
RUN curl -O ${SRC_SITE}/v3.27/cmake-${SRC_VERSION}.tar.gz
RUN echo "${SRC_HASH} cmake-${SRC_VERSION}.tar.gz" | sha256sum -c
FROM fetch as build
RUN tar -xf cmake-${SRC_VERSION}.tar.gz
WORKDIR cmake-${SRC_VERSION}
2023-11-20 03:29:02 +00:00
RUN set -eux; \
./bootstrap \
--prefix=/usr \
--mandir=/share/man \
--datadir=/share/cmake \
--docdir=/share/doc/cmake \
--no-system-cppdap \
--no-system-curl \
--no-system-jsoncpp \
--generator=Ninja; \
ninja
2023-12-16 23:50:40 +00:00
FROM build as install
USER 0:0
RUN DESTDIR=/rootfs bin/cmake -P cmake_install.cmake
COPY --from=musl /lib/* /rootfs/lib/
COPY --from=musl /usr/lib/* /rootfs/usr/lib/
COPY --from=gcc /usr/lib/* /rootfs/usr/lib/
COPY --from=gcc /usr/lib64/* /rootfs/usr/lib/
COPY --from=openssl /usr/lib/* /rootfs/usr/lib/
RUN find /rootfs -exec touch -hcd "@0" "{}" +
2023-11-20 03:29:02 +00:00
2023-12-12 17:45:39 +00:00
FROM scratch as package
2023-12-16 23:50:40 +00:00
COPY --from=install /rootfs /
2023-11-20 03:29:02 +00:00
USER 100:100
ENTRYPOINT ["/usr/bin/cmake"]
CMD ["--version"]