Small path fixups and removal of redundand reads

This commit is contained in:
JustFiesta 2024-05-17 10:44:53 +02:00
parent 7bf4017f68
commit 089b5a660a
2 changed files with 4 additions and 6 deletions

View file

@ -6,9 +6,9 @@
source ./send_image_to_aws.sh
IMAGE_NAME="$ECR_NAME:latest"
FULL_KEY_PATH=""
# Get data from user
read -p "Enter the ECR image name: " IMAGE_NAME
read -p "Enter your AWS Key absoluet path: " FULL_KEY_PATH
# Get the public IP of EC2 instance from previus script
echo "Getting public IP address of EC2 instance..."
@ -33,7 +33,7 @@ fi
# SSH to EC2 and run instance
echo "SSH-ing to EC2 instance and running Docker image from ECR..."
ssh -i /path/to/your/private-key.pem ec2-user@"$PUBLIC_IP" <<EOF
ssh -i "$FULL_KEY_PATH" ec2-user@"$PUBLIC_IP" <<EOF
docker pull "$IMAGE_NAME"
docker run -d -p 80:8080 "$IMAGE_NAME"
EOF

View file

@ -8,15 +8,13 @@
source ./prepare_aws_enviroment.sh
AWS_ACCOUNT_ID=""
DOCKERFILE_DIR=""
# Get data from user
read -p "Enter your AWS account ID: " AWS_ACCOUNT_ID
read -p "Enter the path to Dockerfile directory: " DOCKERFILE_DIR
# Build docker image locally
echo "Building Docker image..."
if docker build -t spring-petclinic "$DOCKERFILE_DIR"; then
if docker build -t spring-petclinic .; then
echo "Docker image built successfully."
else
echo "Error: Failed to build Docker image."