docker: Add Dockerfiles for images needed by AWS gitlab-runners

The built images are set up with fairly recent versions of gcc and
clang:

  - centos_7:     [ gcc@5.5.0 (built from src), clang@6.0.0 (spack-built from src) ]
  - ubuntu_18.04: [ gcc@5.5.0 (system), clang@6.0.0-1ubuntu2 (system) ]
This commit is contained in:
Scott Wittenburg 2018-12-17 17:33:46 -07:00 committed by Peter Scheibel
parent fce1c4133f
commit 05cdb5a0bb
3 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,61 @@
#
# To build this image:
#
# cd <path-to-spack-repo>/share/spack/docker/spack_builder
# docker build -f Dockerfile-spack_builder_centos_7 -t spack_builder_centos_7 .
#
from spack/centos:7
RUN yum update -y && \
yum install -y \
gmp-devel \
libmpc-devel \
mpfr-devel \
vim \
which && \
rm -rf /var/cache/yum && yum clean all
# Download, build and install gcc 5.5.0
RUN mkdir -p /home/spackuser/Download/gcc550/build-gcc550 && \
mkdir -p /opt/gcc/gcc-5.5.0 && \
cd /home/spackuser/Download/gcc550 && \
curl -OL https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz && \
tar -xvf gcc-5.5.0.tar.xz && \
cd build-gcc550 && \
../gcc-5.5.0/configure \
--enable-languages=c,c++,fortran \
--disable-multilib \
--prefix=/opt/gcc/gcc-5.5.0 && \
make -j$(nproc) && \
make install && \
cd /home/spackuser && \
rm -rf /home/spackuser/Download
RUN export PATH=/spack/bin:$PATH && \
spack compiler find /opt/gcc/gcc-5.5.0
RUN sed -i 's/f77: null/f77: \/opt\/gcc\/gcc-5.5.0\/bin\/gfortran/g;s/fc: null/fc: \/opt\/gcc\/gcc-5.5.0\/bin\/gfortran/g' ~/.spack/linux/compilers.yaml
RUN mkdir -p /home/spackuser/spackcommand
COPY update_rpaths.py /home/spackuser/spackcommand/update_rpaths.py
RUN spack python /home/spackuser/spackcommand/update_rpaths.py \
--prefix /opt/gcc/gcc-5.5.0 \
--rpaths /opt/gcc/gcc-5.5.0/lib64
RUN export PATH=/spack/bin:$PATH && \
spack install -y llvm@6.0.0%gcc@5.5.0 && \
spack clean -a
RUN export PATH=/spack/bin:$PATH && \
spack compiler find $(spack location -i llvm@6.0.0%gcc@5.5.0)
RUN sed -i 's/f77: null/f77: \/opt\/gcc\/gcc-5.5.0\/bin\/gfortran/g;s/fc: null/fc: \/opt\/gcc\/gcc-5.5.0\/bin\/gfortran/g' ~/.spack/linux/compilers.yaml
RUN spack python /home/spackuser/spackcommand/update_rpaths.py \
--prefix /spack/opt/spack/linux-centos7-x86_64/gcc-5.5.0/llvm-6.0.0-awfpo7kn3k24weu655rrt2erihzd4gii \
--rpaths /spack/opt/spack/linux-centos7-x86_64/gcc-5.5.0/llvm-6.0.0-awfpo7kn3k24weu655rrt2erihzd4gii/lib

View File

@ -0,0 +1,23 @@
#
# To build this image:
#
# cd <path-to-spack-repo>/share/spack/docker/spack_builder
# docker build -f Dockerfile-spack_builder_ubuntu_18.04 -t spack_builder_ubuntu_18.04 .
#
from spack/ubuntu:bionic
RUN apt-get -yqq update && apt-get -yqq install \
clang \
g++-5 \
gcc-5 \
gfortran-5 \
unzip \
vim && \
rm -rf /var/lib/apt/lists/*
RUN export PATH=/spack/bin:$PATH && \
spack compiler find gcc clang
RUN sed -i 's/f77: null/f77: \/usr\/bin\/gfortran/g;s/fc: null/fc: \/usr\/bin\/gfortran/g' ~/.spack/linux/compilers.yaml

View File

@ -0,0 +1,34 @@
# Copyright 2013-2019 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)
import argparse
from spack.config import config as spack_config
def update_compiler(prefix, rpaths):
compilers_config = spack_config.get('compilers')
for compiler_entry in compilers_config:
if compiler_entry['compiler']['paths']['cc'].startswith(prefix):
print('found target compiler: {0}'.format(
compiler_entry['compiler']['spec']))
compiler_entry['compiler']['extra_rpaths'].append(rpaths)
spack_config.update_config('compilers', compilers_config)
if __name__ == "__main__":
# Create argument parser
parser = argparse.ArgumentParser(
description="Add extra_rpaths to default system compilers.yaml")
parser.add_argument('-p', '--prefix', default=None,
help="Install prefix of compiler to update")
parser.add_argument('-r', '--rpaths', default=None,
help="Extra rpaths to add to target compiler")
args = parser.parse_args()
update_compiler(args.prefix, args.rpaths)