From 0b359730076c22c246bfe5b4ea711b21420f480b Mon Sep 17 00:00:00 2001 From: Vaishnavi Subhedar - Xilinx <141360387+SubhedarV@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:23:44 -0700 Subject: [PATCH] using single [] --- Dockerfile/Dockerfile | 60 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Dockerfile/Dockerfile b/Dockerfile/Dockerfile index 09cba8757d7..6ec78379862 100644 --- a/Dockerfile/Dockerfile +++ b/Dockerfile/Dockerfile @@ -1,30 +1,30 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} - -ARG PACKAGE_FILE - -# Copy the package into the image -COPY ${PACKAGE_FILE} /tmp/ - -# Install the package based on the package type -RUN if [[ "${BASE_IMAGE}" == *centos* || "${BASE_IMAGE}" == *amazonlinux* ]]; then \ - # For RPM packages - yum install -y epel-release && \ - yum install -y dnf-plugins-core wget && \ - yum clean all && \ - yum localinstall -y /tmp/${PACKAGE_FILE} && \ - rm -f /tmp/${PACKAGE_FILE} && \ - # Verify the installation - rpm -qa | grep xrt; \ - elif [[ "${BASE_IMAGE}" == *ubuntu* ]]; then \ - # For DEB packages - apt-get update && \ - apt-get install -y wget && \ - dpkg -i /tmp/${PACKAGE_FILE} || apt-get install -f -y && \ - rm -f /tmp/${PACKAGE_FILE} && \ - # Verify the installation - dpkg -l | grep xrt; \ - else \ - echo "Unsupported base image: ${BASE_IMAGE}"; \ - exit 1; \ - fi +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG PACKAGE_FILE + +# Copy the package into the image +COPY ${PACKAGE_FILE} /tmp/ + +# Install the package based on the package type +RUN if [ "${BASE_IMAGE#*:}" = "centos" ] || [ "${BASE_IMAGE#*:}" = "amazonlinux" ]; then \ + # For RPM packages + yum install -y epel-release && \ + yum install -y dnf-plugins-core wget && \ + yum clean all && \ + yum localinstall -y /tmp/${PACKAGE_FILE} && \ + rm -f /tmp/${PACKAGE_FILE} && \ + # Verify the installation + rpm -qa | grep xrt; \ + elif [ "${BASE_IMAGE#*:}" = "ubuntu" ]; then \ + # For DEB packages + apt-get update && \ + apt-get install -y wget && \ + dpkg -i /tmp/${PACKAGE_FILE} || apt-get install -f -y && \ + rm -f /tmp/${PACKAGE_FILE} && \ + # Verify the installation + dpkg -l | grep xrt; \ + else \ + echo "Unsupported base image: ${BASE_IMAGE}"; \ + exit 1; \ + fi