DockerfileΒΆ

docker-rpmbuild generates a Dockerfile on the fly with the folowing template:

    def _dockerfile(self):
        """Hacking up the unintentional tarball unpack
        https://github.com/dotcloud/docker/issues/3050"""
        return """
            FROM {{ image }}

            RUN yum -y install rpmdevtools yum-utils tar
            RUN rpmdev-setuptree

            {% if sources_dir is not none %}
            ADD SOURCES /rpmbuild/SOURCES
            {% endif %}
            {% for source in sources %}
            ADD {{ source }} /rpmbuild/SOURCES/{{ source }}
            RUN cd /rpmbuild/SOURCES; if [ -d {{ source }} ]; then mv {{ source }} {{ source }}.tmp; tar -C {{ source }}.tmp -czvf {{ source }} .; rm -r {{ source }}.tmp; fi
            RUN chown -R root:root /rpmbuild/SOURCES
            {% endfor %}

            {% if spec %}
            {% for macrofile in macrofiles %}
            ADD {{ macrofile }} /rpmbuild/SPECS/{{ macrofile }}
            {% endfor %}
            ADD {{ spec }} /rpmbuild/SPECS/{{ spec }}
            RUN chown -R root:root /rpmbuild/SPECS
            {% if retrieve %}
            RUN spectool -g -R -A /rpmbuild/SPECS/{{ spec }}
            {% endif %}
            RUN yum-builddep -y $(rpmbuild {% for define in defines %} --define '{{ define }}' {% endfor %} -bs /rpmbuild/SPECS/{{ spec }} | awk '{ print $2 }')
            CMD rpmbuild {% for define in defines %} --define '{{ define }}' {% endfor %} -ba /rpmbuild/SPECS/{{ spec }}
            {% endif %}

            {% if srpm %}
            ADD {{ srpm }} /rpmbuild/SRPMS/{{ srpm }}
            RUN chown -R root:root /rpmbuild/SRPMS
            CMD rpmbuild --rebuild /rpmbuild/SRPMS/{{ srpm }}
            {% endif %}

            """