diff --git a/Dockerfile b/Dockerfile index 8dc7f2f..726d947 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,15 +7,20 @@ RUN apt-get update && apt-get install -y \ libc6-dev \ python3 -RUN git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git +RUN git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git /spack ENV PATH="${PATH}:/spack/bin" COPY spack.yaml /root/spack-env/spack.yaml +RUN spack compiler find + +RUN sed -i '/spec: gcc/s/$/ build_type=Release/' /root/.spack/packages.yaml +RUN sed -i '/gcc.*+strip/s/+strip/~strip/' /root/spack-env/spack.yaml + RUN spack -e /root/spack-env concretize RUN spack -e /root/spack-env fetch -D -RUN spack -e /root/spack-env install --fail-fast +RUN spack -e /root/spack-env install --fail-fast --fresh RUN spack view add -i /bootstrap-view $(spack find -H) @@ -32,16 +37,15 @@ ENV PATH="/bootstrap-view/bin:/spack/bin:${PATH}" COPY spack.yaml /root/spack-env/spack.yaml RUN spack compiler find /bootstrap-view/bin +RUN sed -i '/spec: gcc/s/$/ ~strip/' /root/.spack/packages.yaml RUN spack -e /root/spack-env concretize -Uf -RUN spack -e /root/spack-env install --fail-fast -RUN spack clean -a -RUN spack gc -e /root/spack-env -y -b - +RUN spack -e /root/spack-env install --fail-fast --fresh +RUN spack clean -ab +RUN spack gc -e /root/spack-env -y -FROM docker.io/debian:12.11-slim -RUN rm -rf /usr/bin /usr/sbin +FROM scratch COPY --from=base /spack /spack COPY --from=base /view /view @@ -49,14 +53,16 @@ COPY --from=base /python-view /python-view COPY --from=base /usr/lib /usr/lib/ COPY --from=base /usr/include /usr/include -COPY --from=base /usr/bin/sh /usr/bin/sh -COPY --from=base /usr/bin/env /usr/bin/env ENV SPACK_PYTHON=/python-view/bin/python3 -ENV PATH=/view/bin:/spack/bin:/bin +ENV PATH=/view/bin:/spack/bin -RUN spack compiler find +SHELL ["/view/bin/bash", "-c"] + +RUN ln -s /view/bin /usr/bin +RUN ln -s /view/bin /bin +RUN spack compiler find RUN spack bootstrap now -ENTRYPOINT ["/bin/sh"] +ENTRYPOINT ["/view/bin/bash", "-l", "-c"] diff --git a/spack.yaml b/spack.yaml index 32a832f..8245df1 100644 --- a/spack.yaml +++ b/spack.yaml @@ -4,8 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) spack: specs: + - bash - coreutils - - gcc+binutils@11 + - gcc@14 +binutils +strip build_type=MinSizeRel - git - gmake - patch @@ -20,13 +21,16 @@ spack: final: root: /view select: + - bash - binutils - coreutils - gcc - git + - grep - patch - tar - unzip + - util-linux python: root: /python-view select: [python]