gluster / Gluster-Builds

Testing build automation with GitHub actions for Gluster Repository
MIT License
2 stars 6 forks source link

embed the make process into the Dockerfile #2

Open mykaul opened 3 years ago

mykaul commented 3 years ago

I'm opening an issue as it is up for discussion - should we have the Make process part of the Dockerfile? Here's an example of the Dockerfile I've modified (inc. other modifications):

FROM centos:8

LABEL project="centos8-gluster-build"
LABEL maintainer "gluster-users@gluster.org"

RUN yum -y install --setopt tsflags=nodocs --enablerepo=powertools automake autoconf libtool flex bison \
    openssl-devel libxml2-devel libaio-devel \
    readline-devel glib2-devel userspace-rcu-devel \
    libacl-devel fuse-devel redhat-rpm-config rpcgen libtirpc-devel \
    make python3-devel rsync libuuid-devel rpm-build \
    git attr libcurl-devel selinux-policy-devel firewalld liburing-devel rpcgen && yum clean all

RUN yum -y update --setopt tsflags=nodocs && yum clean all && rm -rf /var/cache/yum

#RUN yum -y install --setopt tsflags=nodocsI epel-release

#RUN yum -y install --setopt tsflags=nodocs --enablerepo=powertools rpcgen

#RUN yum clean all && rm -rf /var/cache/yum

CMD ["/usr/sbin/init"]

RUN git clone --depth 1 https://github.com/gluster/glusterfs.git
WORKDIR glusterfs
RUN ./autogen.sh
RUN ./configure
WORKDIR extras/LinuxRPM
RUN make glusterrpms
msaju commented 3 years ago

Optimized Dockerfile and startscript as below. We need to pull the already built docker image from quay and run only the daily build to generate rpms, that way it looks optimised from my point of view.

===============================Dockerfile============================== FROM centos:8

LABEL project="centos8-gluster-build" LABEL maintainer "gluster-users@gluster.org"

RUN yum -y --setopt tsflags=nodocs --enablerepo=powertools install automake autoconf libtool flex bison \ openssl-devel libxml2-devel libaio-devel \ readline-devel lvm2-devel glib2-devel userspace-rcu-devel libcmocka-devel \ libacl-devel fuse-devel redhat-rpm-config rpcgen libtirpc-devel \ make python3-devel rsync libuuid-devel rpm-build perl-Test-Harness \ git attr libcurl-devel selinux-policy-devel firewalld liburing-devel rpcgen -y

RUN dnf -y install epel-release --setopt tsflags=nodocs

RUN yum -y update --setopt tsflags=nodocs

RUN yum clean all

CMD ["/usr/sbin/init"]

COPY ./startscript.sh /

RUN chmod +x /startscript.sh

CMD /startscript.sh

=====================startscript=================== /usr/sbin/init

git clone --depth 1 https://github.com/gluster/glusterfs.git cd glusterfs ./autogen.sh ./configure cd extras/LinuxRPM make glusterrpms

mykaul commented 3 years ago

I think combining the update and the cleanup is useful to reduce layering: RUN yum -y update --setopt tsflags=nodocs && yum clean all

mykaul commented 3 years ago

I don't think you need libcmocka-devel perl-Test-Harness

msaju commented 3 years ago

Noted, will update the changes into the file..