From 899ac9abee10ac1649873bb17676b7da1b32f22a Mon Sep 17 00:00:00 2001 From: Anton Ovcharenko Date: Wed, 27 Sep 2023 13:21:42 +0300 Subject: [PATCH 1/2] fix tar command syntax for arm platforms Signed-off-by: Anton Ovcharenko --- Dockerfile | 3 ++- Dockerfile.centos | 3 ++- Dockerfile.redhat | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd5d78c..4a26404 100644 --- a/Dockerfile +++ b/Dockerfile @@ -117,7 +117,8 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ perl $APP_ROOT_DIR*/automated_install.pl && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ - [ -d "${APP_SERVER_DIR}/Logs" ] && tar -czvf "${APP_SERVER_DIR}"/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs/* --remove-files || \ + [ -d "${APP_SERVER_DIR}/Logs" ] && \ + tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \ mkdir -p $APP_SERVER_DIR/Logs && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Main.log && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \ diff --git a/Dockerfile.centos b/Dockerfile.centos index f282dc4..789044a 100755 --- a/Dockerfile.centos +++ b/Dockerfile.centos @@ -124,7 +124,8 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ perl $APP_ROOT_DIR*/automated_install.pl && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ - [ -d "${APP_SERVER_DIR}/Logs" ] && tar -czvf "${APP_SERVER_DIR}"/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs/* --remove-files || \ + [ -d "${APP_SERVER_DIR}/Logs" ] && \ + tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \ mkdir -p $APP_SERVER_DIR/Logs && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Main.log && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \ diff --git a/Dockerfile.redhat b/Dockerfile.redhat index 8913f24..07e019c 100644 --- a/Dockerfile.redhat +++ b/Dockerfile.redhat @@ -122,7 +122,8 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ perl $APP_ROOT_DIR*/automated_install.pl && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ - [ -d "${APP_SERVER_DIR}/Logs" ] && tar -czvf "${APP_SERVER_DIR}"/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs/* --remove-files || \ + [ -d "${APP_SERVER_DIR}/Logs" ] && \ + tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \ mkdir -p $APP_SERVER_DIR/Logs && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Main.log && \ ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \ From 8ce0f4fb3c2022910798111c3fcba57168204de8 Mon Sep 17 00:00:00 2001 From: Anton Ovcharenko Date: Thu, 28 Sep 2023 10:12:23 +0300 Subject: [PATCH 2/2] stop docker build if automated_install.pl failed --- Dockerfile | 2 +- Dockerfile.centos | 2 +- Dockerfile.redhat | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a26404..4332d7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -115,7 +115,7 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 [ -z "$PACKAGE_FILE" ] && echo "Error. Docker image build failed: No valid application package detected." && exit 1 || \ echo "Using package file: $PACKAGE_FILE" && \ tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ - perl $APP_ROOT_DIR*/automated_install.pl && \ + perl $APP_ROOT_DIR*/automated_install.pl || exit 1 && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ [ -d "${APP_SERVER_DIR}/Logs" ] && \ tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \ diff --git a/Dockerfile.centos b/Dockerfile.centos index 789044a..8f00e0b 100755 --- a/Dockerfile.centos +++ b/Dockerfile.centos @@ -122,7 +122,7 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 [ -z "$PACKAGE_FILE" ] && echo "Error. Docker image build failed: No valid application package detected." && exit 1 || \ echo "Using package file: $PACKAGE_FILE" && \ tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ - perl $APP_ROOT_DIR*/automated_install.pl && \ + perl $APP_ROOT_DIR*/automated_install.pl || exit 1 && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ [ -d "${APP_SERVER_DIR}/Logs" ] && \ tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \ diff --git a/Dockerfile.redhat b/Dockerfile.redhat index 07e019c..43f04e5 100644 --- a/Dockerfile.redhat +++ b/Dockerfile.redhat @@ -120,7 +120,7 @@ RUN PACKAGE_FILE=$(ls -1t $DEPLOYMENT_DIR/$APP_NAME_MASK 2>/dev/null | head -n 1 [ -z "$PACKAGE_FILE" ] && echo "Error. Docker image build failed: No valid application package detected." && exit 1 || \ echo "Using package file: $PACKAGE_FILE" && \ tar -xvf $PACKAGE_FILE -C $DEPLOYMENT_DIR/ && \ - perl $APP_ROOT_DIR*/automated_install.pl && \ + perl $APP_ROOT_DIR*/automated_install.pl || exit 1 && \ rm -rf $APP_ROOT_DIR* $DEPLOYMENT_DIR/$APP_NAME_MASK && \ [ -d "${APP_SERVER_DIR}/Logs" ] && \ tar czvf ${APP_SERVER_DIR}/Logs/img_build_logs.tar.gz -C ${APP_SERVER_DIR} Logs --remove-files 2> /dev/null || \