Created
July 31, 2025 16:56
-
-
Save Mohammad-Reihani/e720ff6cf0b8af33dc8efa4260bfc3ad to your computer and use it in GitHub Desktop.
Build docker image and save
This file contains hidden or 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
| #!/bin/bash | |
| # === Configuration === | |
| IMAGE_NAME="react-native-android-builder" | |
| IMAGE_TAG="latest" | |
| IMAGE_FILE="$IMAGE_NAME.tar.xz" | |
| DOCKERFILE_PATH="Dockerfile" | |
| BUILD_CONTEXT="." | |
| # === Build === | |
| echo "π§ Building Docker image: $IMAGE_NAME:$IMAGE_TAG ..." | |
| docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f "$DOCKERFILE_PATH" "$BUILD_CONTEXT" | |
| # === Save and Compress === | |
| echo "π¦ Saving and compressing Docker image to $IMAGE_FILE ..." | |
| echo "β³ This might take a while depending on the image size and disk speed." | |
| echo "π‘ Please DO NOT interrupt the process. It's still running unless an error appears." | |
| echo "π You can monitor the file size with: ls -lh $IMAGE_FILE" | |
| docker save "$IMAGE_NAME:$IMAGE_TAG" | xz -T0 -c > "$IMAGE_FILE" | |
| # === Done === | |
| echo "β Docker image saved and compressed successfully: $IMAGE_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment