
This PR adds a new command to Spack: ```console $ spack containerize -h usage: spack containerize [-h] [--config CONFIG] creates recipes to build images for different container runtimes optional arguments: -h, --help show this help message and exit --config CONFIG configuration for the container recipe that will be generated ``` which takes an environment with an additional `container` section: ```yaml spack: specs: - gromacs build_type=Release - mpich - fftw precision=float packages: all: target: [broadwell] container: # Select the format of the recipe e.g. docker, # singularity or anything else that is currently supported format: docker # Select from a valid list of images base: image: "ubuntu:18.04" spack: prerelease # Additional system packages that are needed at runtime os_packages: - libgomp1 ``` and turns it into a `Dockerfile` or a Singularity definition file, for instance: ```Dockerfile # Build stage with Spack pre-installed and ready to be used FROM spack/ubuntu-bionic:prerelease as builder # What we want to install and how we want to install it # is specified in a manifest file (spack.yaml) RUN mkdir /opt/spack-environment \ && (echo "spack:" \ && echo " specs:" \ && echo " - gromacs build_type=Release" \ && echo " - mpich" \ && echo " - fftw precision=float" \ && echo " packages:" \ && echo " all:" \ && echo " target:" \ && echo " - broadwell" \ && echo " config:" \ && echo " install_tree: /opt/software" \ && echo " concretization: together" \ && echo " view: /opt/view") > /opt/spack-environment/spack.yaml # Install the software, remove unecessary deps and strip executables RUN cd /opt/spack-environment && spack install && spack autoremove -y RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \ xargs file -i | \ grep 'charset=binary' | \ grep 'x-executable\|x-archive\|x-sharedlib' | \ awk -F: '{print $1}' | xargs strip -s # Modifications to the environment that are necessary to run RUN cd /opt/spack-environment && \ spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh # Bare OS image to run the installed executables FROM ubuntu:18.04 COPY --from=builder /opt/spack-environment /opt/spack-environment COPY --from=builder /opt/software /opt/software COPY --from=builder /opt/view /opt/view COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh RUN apt-get -yqq update && apt-get -yqq upgrade \ && apt-get -yqq install libgomp1 \ && rm -rf /var/lib/apt/lists/* ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"] ```
104 lines
2.6 KiB
ReStructuredText
104 lines
2.6 KiB
ReStructuredText
.. Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
|
|
Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
|
|
SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
.. Spack documentation master file, created by
|
|
sphinx-quickstart on Mon Dec 9 15:32:41 2013.
|
|
You can adapt this file completely to your liking, but it should at least
|
|
contain the root `toctree` directive.
|
|
|
|
===================
|
|
Spack
|
|
===================
|
|
|
|
.. epigraph::
|
|
|
|
`These are docs for the Spack package manager. For sphere packing, see` `pyspack <https://pyspack.readthedocs.io>`_.
|
|
|
|
Spack is a package management tool designed to support multiple
|
|
versions and configurations of software on a wide variety of platforms
|
|
and environments. It was designed for large supercomputing centers,
|
|
where many users and application teams share common installations of
|
|
software on clusters with exotic architectures, using libraries that
|
|
do not have a standard ABI. Spack is non-destructive: installing a
|
|
new version does not break existing installations, so many
|
|
configurations can coexist on the same system.
|
|
|
|
Most importantly, Spack is *simple*. It offers a simple *spec* syntax
|
|
so that users can specify versions and configuration options
|
|
concisely. Spack is also simple for package authors: package files
|
|
are written in pure Python, and specs allow package authors to
|
|
maintain a single file for many different builds of the same package.
|
|
|
|
See the :doc:`features` for examples and highlights.
|
|
|
|
Get spack from the `github repository
|
|
<https://github.com/spack/spack>`_ and install your first
|
|
package:
|
|
|
|
.. code-block:: console
|
|
|
|
$ git clone https://github.com/spack/spack.git
|
|
$ cd spack/bin
|
|
$ ./spack install libelf
|
|
|
|
If you're new to spack and want to start using it, see :doc:`getting_started`,
|
|
or refer to the full manual below.
|
|
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Basics
|
|
|
|
features
|
|
getting_started
|
|
basic_usage
|
|
workflows
|
|
Tutorial: Spack 101 <https://spack-tutorial.readthedocs.io>
|
|
known_issues
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Reference
|
|
|
|
configuration
|
|
config_yaml
|
|
build_settings
|
|
environments
|
|
containers
|
|
mirrors
|
|
module_file_support
|
|
repositories
|
|
binary_caches
|
|
command_index
|
|
package_list
|
|
chain
|
|
extensions
|
|
pipelines
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Contributing
|
|
|
|
contribution_guide
|
|
packaging_guide
|
|
build_systems
|
|
developer_guide
|
|
docker_for_developers
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: API Docs
|
|
|
|
Spack API Docs <spack>
|
|
LLNL API Docs <llnl>
|
|
|
|
==================
|
|
Indices and tables
|
|
==================
|
|
|
|
* :ref:`genindex`
|
|
* :ref:`modindex`
|
|
* :ref:`search`
|