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/ninja/Dockerfile

49 lines
1.4 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}/make:latest as make
FROM ${REGISTRY}/openssl:latest as openssl
FROM ${REGISTRY}/python:latest as python
2023-12-16 23:50:40 +00:00
FROM ${REGISTRY}/busybox:latest as busybox
2023-11-19 00:53:18 +00:00
2023-12-16 23:50:40 +00:00
FROM busybox as base
2023-11-19 00:53:18 +00:00
ENV SRC_SITE=https://github.com/martine/ninja/archive/
ENV SRC_VERSION=1.9.0
ENV SRC_HASH=5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9
COPY --from=binutils . /
COPY --from=make . /
COPY --from=python . /
COPY --from=musl . /
COPY --from=gcc . /
2023-12-16 23:50:40 +00:00
FROM base as fetch
RUN wget ${SRC_SITE}/v${SRC_VERSION}.tar.gz
RUN echo "${SRC_HASH} v${SRC_VERSION}.tar.gz" | sha256sum -c
FROM fetch as build
RUN tar -xf v${SRC_VERSION}.tar.gz
WORKDIR ninja-${SRC_VERSION}
ADD fix-musl.patch .
RUN patch -p1 < fix-musl.patch
2023-11-19 00:53:18 +00:00
# HACK: figure out why gcc package puts these in the wrong path at install time
COPY --from=gcc /usr/lib64/* /usr/lib/
RUN set -eux; \
2023-12-16 23:50:40 +00:00
python3 ./configure.py --bootstrap
2023-11-19 00:53:18 +00:00
2023-12-16 23:50:40 +00:00
FROM build as install
USER 0:0
RUN set -eux; \
mkdir -p /rootfs/usr/bin/; \
cp ninja /rootfs/usr/bin/
2023-11-19 00:53:18 +00:00
# HACK: figure out why gcc package puts these in the wrong path at install time
2023-12-16 23:50:40 +00:00
COPY --from=gcc /usr/lib64/* /rootfs/usr/lib/
COPY --from=musl . /rootfs/
RUN find /rootfs -exec touch -hcd "@0" "{}" +
2023-11-19 00:53:18 +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-19 00:53:18 +00:00
USER 100:100
ENTRYPOINT ["/usr/bin/ninja"]
CMD ["--version"]