From 8514b9061baa6290da6685c8b5b39772aa5b7733 Mon Sep 17 00:00:00 2001 From: Torben Haack Date: Thu, 10 Oct 2024 09:11:05 +0200 Subject: [PATCH] change deployment strategy --- .gitattributes | 1 - .../docker/build_image.sh | 29 ---------- .../docker/deploy_container.sh | 54 ------------------- .../docker/myp-rp_latest.tar.xz | 3 -- 4 files changed, 87 deletions(-) delete mode 100644 packages/reservation-platform/docker/myp-rp_latest.tar.xz diff --git a/.gitattributes b/.gitattributes index c5e7318..e69de29 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +0,0 @@ -packages/reservation-platform/docker/myp-rp_latest.tar.xz filter=lfs diff=lfs merge=lfs -text diff --git a/packages/reservation-platform/docker/build_image.sh b/packages/reservation-platform/docker/build_image.sh index f830758..296391b 100755 --- a/packages/reservation-platform/docker/build_image.sh +++ b/packages/reservation-platform/docker/build_image.sh @@ -4,9 +4,6 @@ IMAGE_NAME="myp-rp" IMAGE_TAG="latest" -# Specify the output file name (changed extension to .tar.xz for compressed file) -OUTPUT_FILE="myp-rp_latest.tar.xz" - # Build the Docker image from Containerfile echo "Building Docker image from Containerfile..." docker build -t ${IMAGE_NAME}:${IMAGE_TAG} -f $PWD/Containerfile $PWD @@ -18,29 +15,3 @@ if [ $? -ne 0 ]; then 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/myp-rp_latest.tar - -# Check if the save operation was successful -if [ $? -eq 0 ]; then - echo "Image successfully saved to myp-rp_latest.tar" - - # Compress the saved image using xz - echo "Compressing the Docker image with xz..." - xz -z $PWD/docker/myp-rp_latest.tar - - # Check if the compression was successful - if [ $? -eq 0 ]; then - echo "Image successfully compressed to ${OUTPUT_FILE}" - else - echo "Error occurred while compressing the image" - exit 1 - fi -else - echo "Error occurred while saving the image" - exit 1 -fi - -echo "Process completed successfully" diff --git a/packages/reservation-platform/docker/deploy_container.sh b/packages/reservation-platform/docker/deploy_container.sh index 954f695..64d661c 100755 --- a/packages/reservation-platform/docker/deploy_container.sh +++ b/packages/reservation-platform/docker/deploy_container.sh @@ -1,59 +1,5 @@ #!/bin/bash -# Specify the image name and tag -IMAGE_NAME="myp-rp" -IMAGE_TAG="latest" - -# Specify the input file name for the compressed and uncompressed Docker image -INPUT_FILE="myp-rp_latest.tar" -COMPRESSED_INPUT_FILE="myp-rp_latest.tar.xz" - -# Path to the docker directory -DOCKER_DIR="$PWD/docker" - -# Path to the compose file -COMPOSE_FILE="$DOCKER_DIR/compose.yml" - -# Check if the compressed input file exists -if [ -f "$DOCKER_DIR/$COMPRESSED_INPUT_FILE" ]; then - echo "Found compressed Docker image: $COMPRESSED_INPUT_FILE" - - # Decompress the .tar.xz file - echo "Decompressing the Docker image..." - xz -d "$DOCKER_DIR/$COMPRESSED_INPUT_FILE" - - # Check if the decompression was successful - if [ $? -ne 0 ]; then - echo "Error occurred while decompressing $COMPRESSED_INPUT_FILE" - exit 1 - fi - echo "Decompression completed: $INPUT_FILE" -fi - -# Check if the uncompressed 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 diff --git a/packages/reservation-platform/docker/myp-rp_latest.tar.xz b/packages/reservation-platform/docker/myp-rp_latest.tar.xz deleted file mode 100644 index 84ddda2..0000000 --- a/packages/reservation-platform/docker/myp-rp_latest.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:aef5114e323837a39251a28b2ed19f00e6de25d067e55e1a628262572bfa1689 -size 504889672