CD: Package Index (#11665)
Build the docker image for the new package index REST API on each merge/push to develop and master.
This commit is contained in:
		
							
								
								
									
										11
									
								
								share/spack/packages/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								share/spack/packages/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -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;"] | ||||||
							
								
								
									
										17
									
								
								share/spack/packages/build-image.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								share/spack/packages/build-image.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -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 | ||||||
							
								
								
									
										1
									
								
								share/spack/packages/push-image.sh
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								share/spack/packages/push-image.sh
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | build-image.sh | ||||||
							
								
								
									
										20
									
								
								share/spack/packages/split.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								share/spack/packages/split.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -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 | ||||||
| @@ -37,10 +37,14 @@ for config in share/spack/docker/config/* ; do | |||||||
|     ./share/spack/docker/build-image.sh; |     ./share/spack/docker/build-image.sh; | ||||||
| done | done | ||||||
|  |  | ||||||
|  | spack list --format version_json > packages.json | ||||||
|  | ./share/spack/packages/build-image.sh | ||||||
|  |  | ||||||
| if [ "$TEST_SUITE" '=' "docker" -a \ | if [ "$TEST_SUITE" '=' "docker" -a \ | ||||||
|      "$TRAVIS_EVENT_TYPE" != "pull_request" ] && ensure_docker_login ; then |      "$TRAVIS_EVENT_TYPE" != "pull_request" ] && ensure_docker_login ; then | ||||||
|     for config in share/spack/docker/config/* ; do |     for config in share/spack/docker/config/* ; do | ||||||
|         source "$config" |         source "$config" | ||||||
|         ./share/spack/docker/push-image.sh |         ./share/spack/docker/push-image.sh | ||||||
|     done |     done | ||||||
|  |     ./share/spack/packages/push-image.sh | ||||||
| fi | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Axel Huebl
					Axel Huebl