diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/spack/packages/Dockerfile | 11 | ||||
-rwxr-xr-x | share/spack/packages/build-image.sh | 17 | ||||
l--------- | share/spack/packages/push-image.sh | 1 | ||||
-rwxr-xr-x | share/spack/packages/split.sh | 20 | ||||
-rwxr-xr-x | share/spack/qa/run-docker-tests | 4 |
5 files changed, 53 insertions, 0 deletions
diff --git a/share/spack/packages/Dockerfile b/share/spack/packages/Dockerfile new file mode 100644 index 0000000000..716a52ef68 --- /dev/null +++ b/share/spack/packages/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:18.04 AS build-env +WORKDIR /build +RUN apt-get update && apt-get install -y jq +COPY packages.json ./ +COPY split.sh ./ +RUN /build/split.sh + +FROM nginx:mainline-alpine +COPY --from=build-env --chown=nginx:nginx /build/packages /build/packages.json /usr/share/nginx/html/api/ + +CMD ["nginx", "-g", "daemon off;"] diff --git a/share/spack/packages/build-image.sh b/share/spack/packages/build-image.sh new file mode 100755 index 0000000000..c068d11715 --- /dev/null +++ b/share/spack/packages/build-image.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# 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) + +script="$( basename "$0" )" +cd "$( dirname "$0" )" + +export IMAGE="spack/packages.spack.io:latest" + +if [ "$script" '=' 'push-image.sh' ] ; then + docker push "${IMAGE}" +else + docker build -f -t "${IMAGE}" . +fi diff --git a/share/spack/packages/push-image.sh b/share/spack/packages/push-image.sh new file mode 120000 index 0000000000..b3fd71be24 --- /dev/null +++ b/share/spack/packages/push-image.sh @@ -0,0 +1 @@ +build-image.sh
\ No newline at end of file diff --git a/share/spack/packages/split.sh b/share/spack/packages/split.sh new file mode 100755 index 0000000000..2c499926cb --- /dev/null +++ b/share/spack/packages/split.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# 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) + +# split the package index in a small file tree of +# /p/package.json +# files with sub-directories grouped by the initial letter of the packages + +base_dir=$(pwd)/packages/ + +for pkg in $(cat packages.json | jq -c '.[]') +do + name="$(echo ${pkg} | jq -r '.name')"; + first_letter=${name::1} + mkdir -p ${base_dir}${first_letter}/ + echo ${pkg} > ${base_dir}${first_letter}/${name}.json +done diff --git a/share/spack/qa/run-docker-tests b/share/spack/qa/run-docker-tests index 8613c7e728..9bd56535d3 100755 --- a/share/spack/qa/run-docker-tests +++ b/share/spack/qa/run-docker-tests @@ -37,10 +37,14 @@ for config in share/spack/docker/config/* ; do ./share/spack/docker/build-image.sh; done +spack list --format version_json > packages.json +./share/spack/packages/build-image.sh + if [ "$TEST_SUITE" '=' "docker" -a \ "$TRAVIS_EVENT_TYPE" != "pull_request" ] && ensure_docker_login ; then for config in share/spack/docker/config/* ; do source "$config" ./share/spack/docker/push-image.sh done + ./share/spack/packages/push-image.sh fi |