#FROM centos:centos7
FROM ${Cible}:${VersionCible}
LABEL maintainer='Guillaume Astier Ruiz'

ENV os="${Cible}"
ENV osversion="${VersionCible}"
ENV ESL-TOOLS=repo
ENV TERM=xterm

RUN ${PackageManager} update -y

RUN ${PackageManager} install -y perl perl-Carp perl-Compress-Raw-Bzip2 perl-Compress-Raw-Zlib perl-Data-Dumper perl-Data-OptList perl-Digest perl-Digest-MD5 perl-Encode perl-Encode-Locale perl-Error perl-Exporter perl-ExtUtils-Install perl-ExtUtils-MakeMaker perl-ExtUtils-Manifest perl-ExtUtils-ParseXS perl-File-Listing perl-File-Path perl-File-Temp perl-Filter  perl-Getopt-Long  perl-HTML-Parser perl-HTML-Tagset  perl-HTTP-Cookies  perl-HTTP-Date perl-HTTP-Message perl-HTTP-Negotiate perl-HTTP-Tiny perl-IO-Compress perl-IO-HTML perl-IO-Socket-IP perl-IO-Socket-SSL  perl-LWP-MediaTypes  perl-Module-Runtime perl-Mozilla-CA perl-Net-HTTP  perl-Net-SSLeay perl-Package-Generator  perl-Params-Util  perl-PathTools perl-Pod-Escapes perl-Pod-Perldoc perl-Pod-Simple perl-Pod-Usage perl-Scalar-List-Utils perl-Socket perl-Storable perl-Sub-Exporter perl-Sub-Install perl-TermReadKey perl-Test-Harness perl-Text-ParseWords perl-Thread-Queue perl-Time-HiRes perl-Time-Local perl-TimeDate perl-Tk perl-Try-Tiny perl-URI perl-WWW-RobotRules perl-XML-Catalog      perl-XML-LibXML  perl-XML-NamespaceSupport perl-XML-Parser  perl-XML-SAX perl-XML-SAX-Base  perl-XML-Simple perl-XML-TokeParser    perl-XML-XPath  perl-constant perl-devel perl-libs perl-libwww-perl perl-libxml-perl perl-macros perl-parent perl-podlators perl-srpm-macros perl-threads perl-threads-shared 
RUN ${PackageManager} install -y basesystem binutils bzip2 cpp createrepo dejavu-fonts-common dejavu-sans-fonts  dwz elfutils elfutils-devel elfutils-libelf-devel fontconfig fontpackages-filesystem gcc gdb gdbm-devel genisoimage glibc-devel glibc-headers gpm-libs groff-base keyutils-libs-devel libX11 libX11-common libXau libXft libXrender libcom_err-devel libdb-devel libjpeg-turbo libmpc libselinux-devel libsepol-devel libusal libverto-devel libxcb  lm_sensors-devel lm_sensors-libs mailcap mpfr ncurses-base net-tools openssl-devel pcre-devel popt-devel  python3 python-srpm-macros redhat-rpm-config rpm-build rpm-devel rsync strace  tree unzip vim-common vim-enhanced vim-filesystem xz-devel zip zlib-devel nginx openssh-clients


RUN ${PackageManager} install -y net-snmp
RUN ${PackageManager} install epel-release  -y
RUN ${PackageManager} install  screen modulemd-tools gettext net-snmp-devel -y
RUN mkdir /nfs
RUN ln -s /data/repo /nfs/distributions

COPY ./bin/ /usr/local/bin/
RUN chmod 777 /usr/local/bin/run.sh


RUN groupadd esl -g 1000
#RUN useradd  -s /bin/bash -g 1000 -u 1000 -p "$(/usr/bin/openssl passwd -1 esl)" esl
RUN useradd  -s /bin/bash -g 1000 -u 1000  esl
RUN mkdir /data
RUN mkdir -p /tmp/log/
RUN chown -R esl:esl /data
RUN chown -R esl:esl /tmp/log
RUN mkdir -p /nfs/DEVBASE/ESL/
RUN ln -s /data/repo /nfs/DEVBASE/ESL/distributions
USER esl


RUN echo /usr/local/bin/run.sh ${GenScript}
CMD /usr/local/bin/run.sh ${GenScript}
