35 lines
890 B
Bash
Executable File
35 lines
890 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Specify the image name and tag
|
|
IMAGE_NAME="myp-rp"
|
|
IMAGE_TAG="latest"
|
|
|
|
# Specify the output file name (changed extension to .tar)
|
|
OUTPUT_FILE="myp-rp_latest.tar"
|
|
|
|
# Build the Docker image from Containerfile
|
|
echo "Building Docker image from Containerfile..."
|
|
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} -f $PWD/Containerfile $PWD
|
|
|
|
# Check if the build was successful
|
|
if [ $? -ne 0 ]; then
|
|
echo "Error occurred while building the Docker image"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Docker image built successfully"
|
|
|
|
# Save the Docker image without compression
|
|
echo "Saving the Docker image..."
|
|
docker save ${IMAGE_NAME}:${IMAGE_TAG} > $PWD/docker/${OUTPUT_FILE}
|
|
|
|
# Check if the save operation was successful
|
|
if [ $? -eq 0 ]; then
|
|
echo "Image successfully saved to ${OUTPUT_FILE}"
|
|
else
|
|
echo "Error occurred while saving the image"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Process completed successfully"
|