Skip to content

Commit

Permalink
Add images save / load scripts (#181)
Browse files Browse the repository at this point in the history
* Add images save / load scripts

* Some fixes

* Fixes
  • Loading branch information
imsitnikov authored Jul 29, 2024
1 parent b794b66 commit 12d0943
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ zitadel
zitadel-db
.DS_Store
.idea
.env
.env
datalens-images.gz
8 changes: 8 additions & 0 deletions scripts/load-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# chmod +x ./scripts/load-images.sh
# ./scripts/load-images.sh

file=${1:-"datalens-images.gz"}

gzip -cd ${file} | docker load
32 changes: 32 additions & 0 deletions scripts/save-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# chmod +x ./scripts/save-images.sh
# ./scripts/save-images.sh

get_docker_compose_command() {
if command -v docker-compose &>/dev/null; then
echo "docker-compose"
return 0
elif command -v docker compose &>/dev/null; then
echo "docker compose"
return 0
else
echo "Compose plugin for docker is not installed. e.g. sudo apt install docker-compose-plugin" >/dev/stderr
exit 1
fi
}

file=${1:-"docker-compose.yml"}

if [ ! -z ${file} ] && [ -f ${file} ]; then
echo -e "\nPulling images...\n"
images=`grep image: ${file} | awk '{print $2}'`
$(get_docker_compose_command) -f ${file} pull

echo -e "\nSaving images...\n"
docker save ${images} | gzip > datalens-images.gz

echo "Images saved to datalens-images.gz"
else
echo "Incorrect file path"
fi

0 comments on commit 12d0943

Please sign in to comment.