Fix dev image uid and build off rhel7

This commit is contained in:
Robert Parker
2018-08-23 10:16:14 +01:00
parent 64f5ce3624
commit e03ceff7c9
5 changed files with 19 additions and 21 deletions

View File

@@ -30,5 +30,6 @@ podman run \
--env IMAGE_REVISION="$IMAGE_REVISION" \
--env IMAGE_SOURCE="$IMAGE_SOURCE" \
--env MQDEV=${dev} \
--rm \
${tag} \
bash -c "cd /go/src/github.com/ibm-messaging/mq-container/ && ./mq-advanced-server-rhel/go-build.sh"

View File

@@ -28,7 +28,7 @@ set -e
# Use a "scratch" container, so the resulting image has minimal files
# Resulting image won't have yum, for example
readonly ctr_mq=$(buildah from scratch)
readonly ctr_mq=$(buildah from rhel7)
readonly mnt_mq=$(buildah mount $ctr_mq)
readonly archive=downloads/$1
readonly packages=$2
@@ -36,18 +36,12 @@ readonly tag=$3
readonly version=$4
readonly mqdev=$5
# Initialize yum for use with the scratch container
rpm --root $mnt_mq --initdb
yumdownloader --destdir=/tmp redhat-release-server
rpm --root $mnt_mq -ihv /tmp/redhat-release-server*.rpm || true
###############################################################################
# Install MQ server
###############################################################################
# Install the packages required by MQ
yum install -y --installroot=${mnt_mq} --setopt install_weak_deps=false --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 \
buildah run $ctr_mq -- yum install -y --setopt install_weak_deps=false --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 \
bash \
bc \
coreutils \
@@ -63,7 +57,7 @@ yum install -y --installroot=${mnt_mq} --setopt install_weak_deps=false --setopt
util-linux
# Clean up cached files
yum clean all --installroot=${mnt_mq}
buildah run $ctr_mq -- yum clean all
rm -rf ${mnt_mq}/var/cache/yum/*
# Install MQ server packages into the MQ builder image
@@ -110,3 +104,5 @@ buildah config \
$ctr_mq
buildah unmount $ctr_mq
buildah commit $ctr_mq $tag
buildah rm $ctr_mq

View File

@@ -43,3 +43,5 @@ buildah config \
--env CGO_LDFLAGS_ALLOW="-Wl,-rpath.*" \
${ctr}
buildah commit ${ctr} ${tag}
buildah rm ${ctr}

View File

@@ -37,7 +37,7 @@ readonly version=$3
useradd --root $mnt_mq --system --uid 889 --gid mqm admin
groupadd --root $mnt_mq --system --gid 890 mqclient
useradd --root $mnt_mq --system --uid 890 --gid mqclient mqclient
useradd --root $mnt_mq --system --uid 890 --gid app mqclient
buildah run $ctr -- echo admin:passw0rd | chpasswd
@@ -79,3 +79,4 @@ buildah config \
buildah unmount $ctr_mq
buildah commit $ctr_mq $tag
buildah rm $ctr_mq

View File

@@ -22,17 +22,11 @@ set -e
# Use a "scratch" container, so the resulting image has minimal files
# Resulting image won't have yum, for example
readonly ctr_mq=$(buildah from scratch)
readonly ctr_mq=$(buildah from rhel7)
readonly mnt_mq=$(buildah mount $ctr_mq)
readonly imagename=$1
# Initialize yum for use with the scratch container
rpm --root $mnt_mq --initdb
yumdownloader --destdir=/tmp redhat-release-server
rpm --root $mnt_mq -ihv /tmp/redhat-release-server*.rpm || true
yum --installroot $mnt_mq install -y \
buildah run $ctr_mq -- yum install -y \
java-1.7.0-openjdk-devel \
java \
which \
@@ -59,9 +53,13 @@ cp $mnt_mq/usr/src/mymaven/target/lib/*.jar $mnt_mq/opt/app/
rm -rf $mnt_mq/tmp/*
rm -rf $mnt_mq/usr/src/mymaven
# We can't uninstall tar or gzip because
yum --installroot $mnt_mq remove -y \
wget
# We can't uninstall tar or gzip because they are required
buildah run $ctr_mq -- yum remove -y \
wget
# Clean up cached files
buildah run $ctr_mq -- yum clean all
rm -rf ${mnt_mq}/var/cache/yum/*
###############################################################################
# Contain image finalization