Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add images save / load scripts #181

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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