mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 10:41:32 +00:00
Make image packaging and installation optional
Eventually, images should not be transferred as part of the application package, using a more efficient mechanism instead. Other cases may already exist where packaging without the image is preferrable. When the `PACKAGE_IMAGES` variable is not set to 1 (default: 1), images will not be included in the package. The installation script now handles the case where the `images` folder is missing altogether.
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ echo "importing root files"
|
|||||||
cp -rfv $LOCATION/root/* /
|
cp -rfv $LOCATION/root/* /
|
||||||
|
|
||||||
# import docker images
|
# import docker images
|
||||||
for f in $(find $LOCATION/images -name "*.img");do
|
for f in $(find $LOCATION/images -name "*.img" 2>/dev/null);do
|
||||||
echo "importing docker image: $f"
|
echo "importing docker image: $f"
|
||||||
docker load -i $f
|
docker load -i $f
|
||||||
done
|
done
|
||||||
|
|||||||
+29
-18
@@ -11,8 +11,15 @@
|
|||||||
# basic path info
|
# basic path info
|
||||||
LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
PROJECT_ROOT="$(realpath $LOCATION)"
|
PROJECT_ROOT="$(realpath $LOCATION)"
|
||||||
PACKAGE_NAME="streamline-emr"
|
|
||||||
OUTPUT_DIR="$PROJECT_ROOT/build-packages"
|
# configurable options (override with env vars as needed)
|
||||||
|
PACKAGE_NAME=${PACKAGE_NAME-"streamline-emr"}
|
||||||
|
OUTPUT_DIR=${OUTPUT_DIR-"$PROJECT_ROOT/build-packages"}
|
||||||
|
PACKAGE_IMAGES=${PACKAGE_IMAGES:-1}
|
||||||
|
|
||||||
|
echo "packaging $PACKAGE_NAME"
|
||||||
|
echo " output dir: $OUTPUT_DIR"
|
||||||
|
echo " package images: $PACKAGE_IMAGES"
|
||||||
|
|
||||||
# work from the project root
|
# work from the project root
|
||||||
pushd $PROJECT_ROOT > /dev/null
|
pushd $PROJECT_ROOT > /dev/null
|
||||||
@@ -75,22 +82,26 @@ for platform in "linux/amd64" "linux/arm64"; do
|
|||||||
cp ${PROJECT_ROOT}/install.sh ${PACKAGE_ROOT}/
|
cp ${PROJECT_ROOT}/install.sh ${PACKAGE_ROOT}/
|
||||||
cp -a ${PROJECT_ROOT}/root ${PACKAGE_ROOT}/
|
cp -a ${PROJECT_ROOT}/root ${PACKAGE_ROOT}/
|
||||||
|
|
||||||
# add images
|
if [ "${PACKAGE_IMAGES}" = "1" ]; then
|
||||||
i=0
|
# add images
|
||||||
# read image list from file (e.g. 'images-aarch64')
|
i=0
|
||||||
# images are listed as SAVED_TAG=SOURCE_IMAGE
|
# read image list from file (e.g. 'images-aarch64')
|
||||||
for image in $(cat ${PROJECT_ROOT}/images-${pkg_arch});do
|
# images are listed as SAVED_TAG=SOURCE_IMAGE
|
||||||
i=$((i+1))
|
for image in $(cat ${PROJECT_ROOT}/images-${pkg_arch});do
|
||||||
name="image${i}.img"
|
i=$((i+1))
|
||||||
path="${IMAGES_DIR}/${name}"
|
name="image${i}.img"
|
||||||
IFS=\= read -r dest source <<< "${image}"
|
path="${IMAGES_DIR}/${name}"
|
||||||
echo "pulling image '${source}' (${platform})"
|
IFS=\= read -r dest source <<< "${image}"
|
||||||
docker pull --platform ${platform} ${source}
|
echo "pulling image '${source}' (${platform})"
|
||||||
echo "tagging image as '${dest}'"
|
docker pull --platform ${platform} ${source}
|
||||||
docker tag ${source} ${dest}
|
echo "tagging image as '${dest}'"
|
||||||
echo "saving to '${path}'"
|
docker tag ${source} ${dest}
|
||||||
docker save -o ${path} $dest
|
echo "saving to '${path}'"
|
||||||
done
|
docker save -o ${path} $dest
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "skipping image packaging as requested"
|
||||||
|
fi
|
||||||
|
|
||||||
# setup output directory and cleanup old files if necessary
|
# setup output directory and cleanup old files if necessary
|
||||||
mkdir -p $OUTPUT_DIR
|
mkdir -p $OUTPUT_DIR
|
||||||
|
|||||||
Reference in New Issue
Block a user