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