Skip to content

Commit

Permalink
feat: support zstd as archive format
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed Jul 18, 2024
1 parent e034874 commit 1c98521
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions scripts/0_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function prepare_image_files() {

images=$(get_images)
for image in ${images}; do
filename=$(basename "${image}").tar
filename=$(basename "${image}").zst
image_path="${IMAGE_DIR}/${filename}"
md5_filename=$(basename "${image}").md5
md5_path="${IMAGE_DIR}/${md5_filename}"
Expand All @@ -83,7 +83,8 @@ function prepare_image_files() {
fi
fi
echo "$(gettext 'Save image') ${image} -> ${image_path}"
docker save -o "${image_path}" "${image}" &
# docker save -o "${image_path}" "${image}" &
docker save "${image}" | zstd -f -q -o "${image_path}" &
echo "${image_id}" >"${md5_path}" &
done
wait
Expand Down
4 changes: 2 additions & 2 deletions scripts/3_load_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ IMAGE_DIR="images"
function load_image_files() {
images=$(get_images)
for image in ${images}; do
filename=$(basename "${image}").tar
filename=$(basename "${image}").zst
filename_windows=${filename/:/_}
if [[ -f ${IMAGE_DIR}/${filename_windows} ]]; then
filename=${filename_windows}
Expand Down Expand Up @@ -39,7 +39,7 @@ function load_image_files() {
}

function main() {
if [[ -d "${IMAGE_DIR}" && $(find "${IMAGE_DIR}" -type f -name "*.tar" -print -quit 2>/dev/null) ]]; then
if [[ -d "${IMAGE_DIR}" && $(find "${IMAGE_DIR}" -type f -name "*.zst" -print -quit 2>/dev/null) ]]; then
load_image_files
else
pull_images
Expand Down

0 comments on commit 1c98521

Please sign in to comment.