53 lines
1.2 KiB
Bash
Executable File
53 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Specify the image name and tag
|
|
IMAGE_NAME="myp-rp"
|
|
IMAGE_TAG="latest"
|
|
|
|
# Specify the input file name (changed extension to .tar)
|
|
INPUT_FILE="myp-rp_latest.tar"
|
|
|
|
# Path to the docker directory
|
|
DOCKER_DIR="$PWD/docker"
|
|
|
|
# Path to the compose file
|
|
COMPOSE_FILE="$DOCKER_DIR/compose.yml"
|
|
|
|
# Check if the input file exists
|
|
if [ ! -f "$DOCKER_DIR/$INPUT_FILE" ]; then
|
|
echo "Error: $INPUT_FILE not found in $DOCKER_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Load the Docker image
|
|
echo "Loading Docker image from $INPUT_FILE..."
|
|
docker load -i "$DOCKER_DIR/$INPUT_FILE"
|
|
|
|
# Check if the operation was successful
|
|
if [ $? -eq 0 ]; then
|
|
echo "Image successfully loaded into Docker"
|
|
else
|
|
echo "Error occurred while loading the image"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if the compose file exists
|
|
if [ ! -f "$COMPOSE_FILE" ]; then
|
|
echo "Error: compose.yml not found in $DOCKER_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Execute docker compose
|
|
echo "Running docker compose..."
|
|
docker compose -f "$COMPOSE_FILE" up -d
|
|
|
|
# Check if the operation was successful
|
|
if [ $? -eq 0 ]; then
|
|
echo "Docker compose executed successfully"
|
|
else
|
|
echo "Error occurred while executing docker compose"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Process completed successfully"
|