forked from FairRootGroup/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build the docker image for the new package index REST API on each merge/push to develop and master.
- Loading branch information
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build-image.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters