diff --git a/lazyDir/centos6.Dockerfile b/lazyDir/centos6.Dockerfile index ff9cf24..812089c 100644 --- a/lazyDir/centos6.Dockerfile +++ b/lazyDir/centos6.Dockerfile @@ -23,22 +23,34 @@ # Import local GPG keys and enable epel repo RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 && \ yum -q clean expire-cache && \ - yum -q -y update && \ - yum -y install --setopt=tsflags=nodocs epel-release && \ + yum -q makecache && \ + yum -y install --setopt=tsflags=nodocs \ + epel-release \ + && \ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 && \ yum -q -y clean all --enablerepo='*' # Install common requirements RUN yum -q clean expire-cache && \ - yum -q -y update && \ + yum -q makecache && \ yum -y install --setopt=tsflags=nodocs \ git \ - wget \ unzip \ + wget \ which \ && \ yum -q -y clean all --enablerepo='*' +# Enable Software Collections +RUN yum -q clean expire-cache && \ + yum -q makecache && \ + yum -y install --setopt=tsflags=nodocs \ + centos-release-scl \ + scl-utils-build \ + && \ + rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo && \ + yum -q -y clean all --enablerepo='*' + # Import extra GPG keys RUN rpm --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppet && \ rpm --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs && \ @@ -50,19 +62,20 @@ update-ca-trust extract # Configure global Yum repos -RUN rm -f /etc/yum.repos.d/*.repo && \ - echo '[all]' > /etc/yum.repos.d/all.repo && \ - echo 'name=Private - centos6-x86_64 - All' >> /etc/yum.repos.d/all.repo && \ - echo 'baseurl=https://mrepo.boxtel/mrepo/testci/centos6-x86_64/RPMS.all' >> /etc/yum.repos.d/all.repo && \ - echo 'enabled=1' >> /etc/yum.repos.d/all.repo +RUN rm -rf /var/cache/yum/* && \ + rm -f /etc/yum.repos.d/*.repo && \ + echo '[all]' > /etc/yum.repos.d/all.repo && \ + echo 'name=Private - centos6-x86_64 - All' >> /etc/yum.repos.d/all.repo && \ + echo 'baseurl=https://mrepo.boxtel/mrepo/testci/centos6-x86_64/RPMS.all' >> /etc/yum.repos.d/all.repo && \ + echo 'enabled=1' >> /etc/yum.repos.d/all.repo # Install something and its requirements #RUN yum -q clean expire-cache && \ -# yum -q -y update && \ -# yum -y install --setopt=tsflags=nodocs \ -# ... -# && \ -# yum -q -y clean all --enablerepo='*' +# yum -q makecache && \ +# yum -y install --setopt=tsflags=nodocs \ +# ... +# && \ +# yum -q -y clean all --enablerepo='*' # Add a dummy user ARG uid=1000 @@ -70,7 +83,10 @@ ARG gid=1000 ARG group=dummy -RUN groupadd -g "${gid}" "${group}" && useradd -ms /bin/bash -g "${group}" -u "${uid}" "${user}" +# Add or modify user and group for build and runtime (convenient) +RUN id ${user} > /dev/null 2>&1 && \ + { groupmod -g "${gid}" "${group}" && usermod -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } || \ + { groupadd -g "${gid}" "${group}" && useradd -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } # Get script directory from lazyLib ARG dir=. diff --git a/lazyDir/centos7.Dockerfile b/lazyDir/centos7.Dockerfile index 3cca266..343f350 100644 --- a/lazyDir/centos7.Dockerfile +++ b/lazyDir/centos7.Dockerfile @@ -23,22 +23,34 @@ # Import local GPG keys and enable epel repo RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ yum -q clean expire-cache && \ - yum -q -y update && \ - yum -y install --setopt=tsflags=nodocs epel-release && \ + yum -q makecache && \ + yum -y install --setopt=tsflags=nodocs \ + epel-release \ + && \ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && \ yum -q -y clean all --enablerepo='*' # Install common requirements RUN yum -q clean expire-cache && \ - yum -q -y update && \ + yum -q makecache && \ yum -y install --setopt=tsflags=nodocs \ git \ - wget \ unzip \ + wget \ which \ && \ yum -q -y clean all --enablerepo='*' +# Enable Software Collections +RUN yum -q clean expire-cache && \ + yum -q makecache && \ + yum -y install --setopt=tsflags=nodocs \ + centos-release-scl \ + scl-utils-build \ + && \ + rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo && \ + yum -q -y clean all --enablerepo='*' + # Import extra GPG keys RUN rpm --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppet && \ rpm --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs && \ @@ -49,21 +61,32 @@ update-ca-trust force-enable && \ update-ca-trust extract +# Configure global Yum repos +RUN rm -rf /var/cache/yum/* && \ + rm -f /etc/yum.repos.d/*.repo && \ + echo '[all]' > /etc/yum.repos.d/all.repo && \ + echo 'name=Private - centos7-x86_64 - All' >> /etc/yum.repos.d/all.repo && \ + echo 'baseurl=https://mrepo.boxtel/mrepo/testci/centos7-x86_64/RPMS.all' >> /etc/yum.repos.d/all.repo && \ + echo 'enabled=1' >> /etc/yum.repos.d/all.repo + # Install something and its requirements #RUN yum -q clean expire-cache && \ -# yum -q -y update && \ -# yum -y install --setopt=tsflags=nodocs \ -# ... -# && \ -# yum -q -y clean all --enablerepo='*' +# yum -q makecache && \ +# yum -y install --setopt=tsflags=nodocs \ +# ... +# && \ +# yum -q -y clean all --enablerepo='*' -# Add user to build and package +# Add a dummy user ARG uid=1000 ARG user=dummy ARG gid=1000 ARG group=dummy -RUN groupadd -g "${gid}" "${group}" && useradd -ms /bin/bash -g "${group}" -u "${uid}" "${user}" +# Add or modify user and group for build and runtime (convenient) +RUN id ${user} > /dev/null 2>&1 && \ + { groupmod -g "${gid}" "${group}" && usermod -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } || \ + { groupadd -g "${gid}" "${group}" && useradd -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } # Get script directory from lazyLib ARG dir=. diff --git a/lazyDir/ubuntu16.Dockerfile b/lazyDir/ubuntu16.Dockerfile index bdb260a..6a49ea1 100644 --- a/lazyDir/ubuntu16.Dockerfile +++ b/lazyDir/ubuntu16.Dockerfile @@ -1,18 +1,38 @@ +# +# This work is protected under copyright law in the Kingdom of +# The Netherlands. The rules of the Berne Convention for the +# Protection of Literary and Artistic Works apply. +# Digital Me B.V. is the copyright owner. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + # Pull base image from official repo FROM ubuntu:16.04 # Install all current updates -RUN apt-get -y update \ - && apt-get -y dist-upgrade \ - && apt-get clean +RUN apt-get -y update && \ + apt-get -y dist-upgrade && \ + apt-get clean # Install common requirements -RUN apt-get -y update \ - && apt-get -y install \ - git \ - wget \ - unzip \ - && apt-get clean +RUN apt-get -y update && \ + apt-get -y install \ + git \ + unzip \ + wget \ + && \ + apt-get clean # Add user to build and package ARG uid=1000 @@ -20,7 +40,10 @@ ARG gid=1000 ARG group=dummy -RUN groupadd -g "${gid}" "${group}" && useradd -ms /bin/bash -g "${group}" -u "${uid}" "${user}" +# Add or modify user and group for build and runtime (convenient) +RUN id ${user} > /dev/null 2>&1 && \ + { groupmod -g "${gid}" "${group}" && usermod -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } || \ + { groupadd -g "${gid}" "${group}" && useradd -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } # Get script directory from lazyLib ARG dir=.