Skip to content
Open
32 changes: 19 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -32,31 +37,32 @@ 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
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"]
6 changes: 5 additions & 1 deletion spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
Loading