From c274834defb75dd64171332d30bfa67d888fbd22 Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Fri, 30 Dec 2016 15:07:32 -0800 Subject: [PATCH] Using hook script and flattening dir structure. Learned this from https://github.com/docker/hub-feedback/issues/508#issuecomment-254342911 and from https://github.com/git-lfs/build-dockers No longer using wget since build.sh is on the same level as the Dockerfile. --- Dockerfile | 2 ++ centos/6/Dockerfile => centos6.Dockerfile | 6 +++--- centos/7/Dockerfile => centos7.Dockerfile | 5 ++--- fedora/22/Dockerfile => fedora22.Dockerfile | 5 ++--- fedora/23/Dockerfile => fedora23.Dockerfile | 5 ++--- fedora/24/Dockerfile => fedora24.Dockerfile | 5 ++--- fedora/25/Dockerfile => fedora25.Dockerfile | 5 ++--- fedora/rawhide/Dockerfile => fedoraRawhide.Dockerfile | 5 ++--- hooks/post_checkout | 9 +++++++++ 9 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 Dockerfile rename centos/6/Dockerfile => centos6.Dockerfile (64%) rename centos/7/Dockerfile => centos7.Dockerfile (64%) rename fedora/22/Dockerfile => fedora22.Dockerfile (69%) rename fedora/23/Dockerfile => fedora23.Dockerfile (69%) rename fedora/24/Dockerfile => fedora24.Dockerfile (69%) rename fedora/25/Dockerfile => fedora25.Dockerfile (69%) rename fedora/rawhide/Dockerfile => fedoraRawhide.Dockerfile (69%) create mode 100644 hooks/post_checkout diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2be35ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM fedora:rawhide +# Dummy file to be replaced by post_checkout hook. diff --git a/centos/6/Dockerfile b/centos6.Dockerfile similarity index 64% rename from centos/6/Dockerfile rename to centos6.Dockerfile index d2ccd51..e363238 100644 --- a/centos/6/Dockerfile +++ b/centos6.Dockerfile @@ -3,13 +3,13 @@ MAINTAINER Robpol86 RUN yum update -y && \ yum groupinstall -y "Development Tools" && \ - yum install -y centos-packager rpmdevtools wget + yum install -y centos-packager rpmdevtools VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] +ADD build.sh build.sh RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/centos/7/Dockerfile b/centos7.Dockerfile similarity index 64% rename from centos/7/Dockerfile rename to centos7.Dockerfile index a6d4536..f7b0eb5 100644 --- a/centos/7/Dockerfile +++ b/centos7.Dockerfile @@ -3,13 +3,12 @@ MAINTAINER Robpol86 RUN yum update -y && \ yum groupinstall -y "Development Tools" && \ - yum install -y centos-packager rpmdevtools wget + yum install -y centos-packager rpmdevtools VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/fedora/22/Dockerfile b/fedora22.Dockerfile similarity index 69% rename from fedora/22/Dockerfile rename to fedora22.Dockerfile index e29534d..89d57b8 100644 --- a/fedora/22/Dockerfile +++ b/fedora22.Dockerfile @@ -2,13 +2,12 @@ FROM fedora:22 MAINTAINER Robpol86 RUN dnf update -y && \ - dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core wget + dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/fedora/23/Dockerfile b/fedora23.Dockerfile similarity index 69% rename from fedora/23/Dockerfile rename to fedora23.Dockerfile index 15243e6..d315464 100644 --- a/fedora/23/Dockerfile +++ b/fedora23.Dockerfile @@ -2,13 +2,12 @@ FROM fedora:23 MAINTAINER Robpol86 RUN dnf update -y && \ - dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core wget + dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/fedora/24/Dockerfile b/fedora24.Dockerfile similarity index 69% rename from fedora/24/Dockerfile rename to fedora24.Dockerfile index 608f524..6a19e44 100644 --- a/fedora/24/Dockerfile +++ b/fedora24.Dockerfile @@ -2,13 +2,12 @@ FROM fedora:24 MAINTAINER Robpol86 RUN dnf update -y && \ - dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core wget + dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/fedora/25/Dockerfile b/fedora25.Dockerfile similarity index 69% rename from fedora/25/Dockerfile rename to fedora25.Dockerfile index 70fcd49..5cdda17 100644 --- a/fedora/25/Dockerfile +++ b/fedora25.Dockerfile @@ -2,13 +2,12 @@ FROM fedora:25 MAINTAINER Robpol86 RUN dnf update -y && \ - dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core wget + dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/fedora/rawhide/Dockerfile b/fedoraRawhide.Dockerfile similarity index 69% rename from fedora/rawhide/Dockerfile rename to fedoraRawhide.Dockerfile index 43e6e8d..5c3c777 100644 --- a/fedora/rawhide/Dockerfile +++ b/fedoraRawhide.Dockerfile @@ -2,13 +2,12 @@ FROM fedora:rawhide MAINTAINER Robpol86 RUN dnf update -y && \ - dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core wget + dnf install -y @development-tools fedora-packager rpmdevtools dnf-plugins-core VOLUME ["/RPMS", "/SRPMS", "/SOURCES", "/SPECS"] RUN useradd rpm && \ su rpm -lc rpmdev-setuptree && \ - su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' && \ - wget https://raw.githubusercontent.com/Robpol86/dockerRPMbuild/${GIT_REF:-master}/build.sh + su rpm -lc 'for d in RPMS SRPMS SOURCES SPECS; do rmdir rpmbuild/$d; ln -s /$d $_; done' ENTRYPOINT ["bash", "build.sh"] diff --git a/hooks/post_checkout b/hooks/post_checkout new file mode 100644 index 0000000..40c390b --- /dev/null +++ b/hooks/post_checkout @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e # Exit script if a command fails. +set -o pipefail # Exit script if any piped program fails instead of just the last program. +set -u # Treat unset variables as errors and exit immediately. +set -x # Print commands run by script to standard out. + +printenv +cp ${DOCKER_TAG}.Dockerfile Dockerfile