From 89a13d86c6b35563e253f6e6883fc8fce67560f1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 3 Jan 2023 15:35:56 +0100 Subject: [PATCH] Docker: Add stuff to build old Debian versions images --- docker/Dockerfile | 6 +++--- docker/Dockerfile-jessie | 41 ++++++++++++++++++++++++++++++++++++++++ docker/bashrc | 7 +++++-- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 docker/Dockerfile-jessie diff --git a/docker/Dockerfile b/docker/Dockerfile index 56e618a5..b397a9b4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,12 +3,12 @@ FROM debian:11 RUN apt-get update RUN apt-get upgrade -y # Install LdapSaisie APT repository -RUN apt-get install -y wget gnupg +RUN apt-get install -y --force-yes wget gnupg lsb-release RUN wget -O - http://ldapsaisie.org/debian/ldapsaisie.gpg.key | apt-key add - -COPY apt.list /etc/apt/sources.list.d/ldapsaisie.list +RUN echo "deb http://ldapsaisie.org/debian $( lsb_release -c -s ) main" > /etc/apt/sources.list.d/ldapsaisie.list RUN apt-get update # Install dependencies -RUN DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y git slapd apache2 php-ldap libapache2-mod-php php-cli smarty3 php-net-ldap2 php-net-ftp php-mail php-mail-mime php-console-table ldapvi locales sed bash-completion liquidprompt vim curl jq iproute2 net-tools composer php-cas php-zxcvbn php-phpseclib +RUN DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y git slapd apache2 php-ldap libapache2-mod-php php-cli smarty3 php-net-ldap2 php-net-ftp php-mail php-mail-mime php-console-table ldapvi locales sed bash-completion liquidprompt vim curl jq iproute2 net-tools composer php-cas php-zxcvbn php-phpseclib php-zip # Add fr_FR* locales RUN sed -i 's/^# fr_FR/fr_FR/' /etc/locale.gen RUN locale-gen diff --git a/docker/Dockerfile-jessie b/docker/Dockerfile-jessie new file mode 100644 index 00000000..fe1daf13 --- /dev/null +++ b/docker/Dockerfile-jessie @@ -0,0 +1,41 @@ +FROM debian:8 +# Update/upgrade +RUN apt-get update +RUN apt-get upgrade -y +# Install LdapSaisie APT repository +RUN apt-get install -y --force-yes wget gnupg lsb-release +RUN wget -O - http://ldapsaisie.org/debian/ldapsaisie.gpg.key | apt-key add - +RUN echo "deb http://ldapsaisie.org/debian $( lsb_release -c -s ) main" > /etc/apt/sources.list.d/ldapsaisie.list +RUN apt-get update +# Install dependencies +RUN DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y --force-yes git slapd apache2 php5-ldap libapache2-mod-php5 php5-cli smarty3 php-net-ldap2 php-net-ftp php-mail php-mail-mime php-console-table ldapvi locales sed bash-completion vim curl jq iproute2 net-tools php-cas php-zxcvbn +# Install composer +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && chmod 755 /usr/local/bin/composer && rm -f composer-setup.php +# Add fr_FR* locales +RUN sed -i 's/^# fr_FR/fr_FR/' /etc/locale.gen +RUN locale-gen +# Clone sources +RUN git clone https://gitlab.easter-eggs.com/ee/ldapsaisie.git /var/www/ldapsaisie +# Fix www-data permission on temporary directory +RUN chown www-data: -R /var/www/ldapsaisie/src/tmp/ +# Configure slapd and load lsexample directory +RUN killall slapd || echo slapd is not running +RUN /var/www/ldapsaisie/lsexample/restore_lsexample -v +# Configure and enable ldapsaisie VirtualHost (as default) +RUN a2dissite 000-default +COPY apache2.conf /etc/apache2/sites-available/ldapsaisie.conf +RUN a2ensite ldapsaisie +RUN a2enmod rewrite +RUN service apache2 restart +# Install ldapsaisie binary (with its bash-completion config) +RUN ln -s /var/www/ldapsaisie/src/bin/ldapsaisie.php /usr/local/sbin/ldapsaisie +RUN ln -s /var/www/ldapsaisie/debian/ldapsaisie.bash-completion /usr/share/bash-completion/completions/ldapsaisie +# Install vimrc.local file +COPY vimrc.local /etc/vim/vimrc.local +# Install entrypoint +COPY bashrc /root/.bashrc +COPY entrypoint.sh /usr/local/sbin/entrypoint.sh +RUN echo "ldapsaisie-dev" > /etc/hostname +ENTRYPOINT /usr/local/sbin/entrypoint.sh +EXPOSE 80 389 diff --git a/docker/bashrc b/docker/bashrc index e7b97adf..84de61ac 100644 --- a/docker/bashrc +++ b/docker/bashrc @@ -3,5 +3,8 @@ HISTSIZE=1000 HISTFILESIZE=2000 source /etc/bash_completion -# Only load liquidprompt in interactive shells, not from a script or from scp -echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt +if [ -x /usr/share/liquidprompt/liquidprompt ] +then + # Only load liquidprompt in interactive shells, not from a script or from scp + echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt +fi