From 0e18f17dc92f1b1ac604bdc2cbfc31f6b82d4a16 Mon Sep 17 00:00:00 2001 From: "arthur.barr@uk.ibm.com" Date: Mon, 30 May 2022 14:31:31 +0100 Subject: [PATCH] Faster build without separate SDK install Before this change, only the MQ SDK was installed into the go-toolset image, for use at build time. The genmqpkg command could take around a minute. --- Dockerfile-server | 10 ++++------ install-mq.sh | 14 ++++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Dockerfile-server b/Dockerfile-server index 5975a97..2605cc5 100644 --- a/Dockerfile-server +++ b/Dockerfile-server @@ -30,12 +30,10 @@ ARG IMAGE_SOURCE="Not specified" ARG IMAGE_TAG="Not specified" ARG GO_WORKDIR USER 0 -COPY install-mq.sh /usr/local/bin/ -# Install the MQ SDK -RUN mkdir /opt/mqm \ - && chmod a+x /usr/local/bin/install-mq.sh \ - && sleep 1 \ - && INSTALL_SDK=1 install-mq.sh \ +WORKDIR /opt/mqm +# Download and extract MQ files, to get the MQ client needed to compile. +# Only extract certain MQ files to make the build quicker +RUN curl --fail --location $MQ_URL | tar --extract --gunzip \ && chown -R 1001:root /opt/mqm/* WORKDIR $GO_WORKDIR/ COPY go.mod go.sum ./ diff --git a/install-mq.sh b/install-mq.sh index 2a97964..eb6af92 100644 --- a/install-mq.sh +++ b/install-mq.sh @@ -21,17 +21,11 @@ set -ex test -f /usr/bin/rpm && RPM=true || RPM=false test -f /usr/bin/apt-get && UBUNTU=true || UBUNTU=false -# Only install the SDK package as part of the build stage -INSTALL_SDK=${INSTALL_SDK:-0} - # Download and extract the MQ unzippable server DIR_TMP=/tmp/mq mkdir -p ${DIR_TMP} cd ${DIR_TMP} -curl --fail --remote-name --location $MQ_URL - -tar -xzf ./*.tar.gz -rm -f ./*.tar.gz +curl --fail --location $MQ_URL | tar --extract --gunzip ls -la ${DIR_TMP} # Generate MQ package in INSTALLATION_DIR @@ -53,7 +47,7 @@ export genmqpkg_incmqxr=0 export genmqpkg_incnls=1 export genmqpkg_incras=1 export genmqpkg_incsamp=1 -export genmqpkg_incsdk=$INSTALL_SDK +export genmqpkg_incsdk=0 export genmqpkg_inctls=1 export genmqpkg_incunthrd=0 export genmqpkg_incweb=1 @@ -97,8 +91,8 @@ $RPM && PAM_FILE=/etc/pam.d/password-auth sed -i 's/password\t\[success=1 default=ignore\]\tpam_unix\.so obscure sha512/password\t[success=1 default=ignore]\tpam_unix.so obscure sha512 minlen=8/' $PAM_FILE # List all the installed packages, for the build log -$RPM && rpm -q --all || true -$UBUNTU && dpkg --list || true +$RPM && (rpm -q --all | sort) || true +$UBUNTU && (dpkg --list | sort) || true #Update the license file to include UBI 8 instead of UBI 7 sed -i 's/v7.0/v8.0/g' /opt/mqm/licenses/non_ibm_license.txt