Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions container/buildcache.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Multi-stage variant of ./Dockerfile.
#
# Instead of pulling a prebuilt buildcache, this builds the buildcache
# locally from container/spack.yaml in a "builder" stage, then copies
# it into the tutorial image. Use it to try out new specs: edit
# container/spack.yaml and rebuild.
#
# docker build -f container/buildcache.dockerfile -t tutorial:experimental container
#

# ---- stage 1: build the buildcache ----
FROM ghcr.io/spack/tutorial-ubuntu-26.04:v2026-06-09 AS builder

ENV DEBIAN_FRONTEND=noninteractive
ENV SPACK_ROOT=/spack/spack
ENV PATH=$SPACK_ROOT/bin:$PATH
ENV SPACK_COMMIT=63943396d634faa92cb59474df3558ec9b9b2425
ENV SPACK_PACKAGES_COMMIT=688a7045fbcaea7b4965ac51e266408a0b591b9d

# Base image has no spack, so clone it and pin to a specific commit.
RUN git clone --depth 1 https://github.com/spack/spack.git $SPACK_ROOT && \
git -C $SPACK_ROOT fetch --depth 1 origin $SPACK_COMMIT && \
git -C $SPACK_ROOT checkout $SPACK_COMMIT

# Pin the builtin package repository to a specific commit.
RUN spack repo update builtin --commit $SPACK_PACKAGES_COMMIT

COPY spack.yaml /opt/spack-environment/spack.yaml

RUN --mount=type=cache,target=/home/software/spack \
spack -e /opt/spack-environment concretize -f && \
spack -e /opt/spack-environment install --fail-fast

RUN --mount=type=cache,target=/home/software/spack \
spack -e /opt/spack-environment buildcache push --unsigned --update-index /mirror && \
chmod -R go+r /mirror

# ---- stage 2: the tutorial image ----
FROM ghcr.io/spack/tutorial-ubuntu-26.04:v2026-06-09

ENV DEBIAN_FRONTEND=noninteractive

# Same tooling as ./Dockerfile, minus rclone (no longer needed).
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
bash-completion \
ca-certificates \
emacs \
jq \
less \
vim

# Bring in the buildcache produced by the builder stage.
COPY --from=builder /mirror /mirror

COPY packages.yaml /etc/spack/packages.yaml
COPY config.yaml /etc/spack/config.yaml
COPY concretizer.yaml /etc/spack/concretizer.yaml

RUN useradd -ms /bin/bash spack && \
chmod -R go+r /etc/spack

USER spack

WORKDIR /home/spack

ENTRYPOINT [ "bash" ]
80 changes: 80 additions & 0 deletions container/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
spack:
view: false

packages:
all:
require:
- target=x86_64_v3
tbb:
require: intel-tbb

specs:
- group: compiler
specs:
- gcc@16 build_type=Release +profiled +strip

- group: "gcc@15 specs"
specs:
- zlib-ng@2.2.4
- zlib-ng@2.0.7
- zlib-ng +ipo
- zlib-ng build_type=Debug
- zlib-ng %clang
- tcl ^zlib-ng@2.2.4
- tcl ^zlib-ng@2.0.7 %clang
- tcl ^zlib-ng %gcc@14
- hdf5+mpi^openmpi
- hdf5~mpi
- hdf5+hl+mpi ^mpich
- trilinos ^openmpi
- trilinos +hdf5 ^hdf5+hl+mpi ^mpich
- mpileaks
- lmod@8.7.67
- environment-modules
- macsio@1.1+scr ^scr@2.0.0~fortran ^silo~fortran ^hdf5~fortran
- julia ^llvm ~clang ~gold ~lldb ~lua ~polly compiler-rt=none libcxx=none libunwind=none targets=x86 ^openblas threads=openmp
- vim
override:
packages:
c:
prefer: [gcc@15]
cxx:
prefer: [gcc@15]
fortran:
prefer: [gcc@15]

- group: scalapacks
needs: [compiler]
specs:
- matrix:
- [netlib-scalapack]
- [^mpich, ^openmpi]
- [^openblas, ^netlib-lapack]
- matrix:
- [py-scipy ^openblas, armadillo ^openblas, netlib-lapack, openmpi, mpich, elpa ^mpich]
override:
packages:
c:
prefer: [gcc@16]
cxx:
prefer: [gcc@16]
fortran:
prefer: [gcc@16]

concretizer:
unify: false
reuse: false
targets:
granularity: generic

config:
installer: new
misc_cache: "$user_cache_path/cache"
db_lock_timeout: 120
shared_linking:
missing_library_policy: warn
install_tree:
root: /home/software/spack
padded_length: 256
projections:
all: "{architecture.platform}-{architecture.target}/{name}-{version}-{hash}"
Loading