mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-22 00:13:51 +01:00
Improve docker image to make it smaller
This commit is contained in:
parent
753f47fa97
commit
15f67ef00d
6 changed files with 61 additions and 39 deletions
|
@ -1,37 +1,55 @@
|
|||
# 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 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
|
||||
# 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
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Update/upgrade, configure LdapSaisie APT repo and install dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y --force-yes wget gnupg lsb-release && \
|
||||
wget -O - http://ldapsaisie.org/debian/ldapsaisie.gpg.key | apt-key add - && \
|
||||
echo "deb http://ldapsaisie.org/debian $( lsb_release -c -s ) main" > /etc/apt/sources.list.d/ldapsaisie.list && \
|
||||
apt-get update && \
|
||||
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-html2text \
|
||||
php-console-table \
|
||||
ldapvi \
|
||||
locales \
|
||||
sed \
|
||||
bash-completion \
|
||||
liquidprompt \
|
||||
vim \
|
||||
curl \
|
||||
jq \
|
||||
iproute2 \
|
||||
net-tools \
|
||||
composer \
|
||||
php-cas \
|
||||
php-zxcvbn \
|
||||
php-phpseclib \
|
||||
php-zip && \
|
||||
apt-get clean && \
|
||||
rm -fr rm -rf /var/lib/apt/lists/*
|
||||
COPY rootfs /
|
||||
# Install LdapSaisie from sources, configure slapd and load lsexample directory
|
||||
RUN git clone https://gitlab.easter-eggs.com/ee/ldapsaisie.git /var/www/ldapsaisie && \
|
||||
ln -s /var/www/ldapsaisie/src/bin/ldapsaisie.php /usr/local/sbin/ldapsaisie && \
|
||||
ln -s /var/www/ldapsaisie/debian/ldapsaisie.bash-completion /usr/share/bash-completion/completions/ldapsaisie && \
|
||||
chown www-data: -R /var/www/ldapsaisie/src/tmp/ && \
|
||||
sed -i 's/^# fr_FR/fr_FR/' /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
a2dissite 000-default && \
|
||||
a2ensite ldapsaisie && \
|
||||
a2enmod rewrite && \
|
||||
/var/www/ldapsaisie/lsexample/restore_lsexample -v
|
||||
# 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
|
||||
ENTRYPOINT /entrypoint.sh
|
||||
EXPOSE 80 389
|
||||
|
|
12
docker/build-and-push-all.sh
Normal file → Executable file
12
docker/build-and-push-all.sh
Normal file → Executable file
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $( dirname $0 )
|
||||
DIST="$1"
|
||||
|
||||
# Need to use Dockerfile+ (https://github.com/edrevo/dockerfile-plus)
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
@ -10,9 +11,12 @@ LATEST_DIST=${DISTS[0]}
|
|||
|
||||
for dist in ${DISTS[@]}
|
||||
do
|
||||
docker build -t brenard/ldapsaisie:$dist -f Dockerfile.$dist .
|
||||
[ $? -eq 0 ] && docker push brenard/ldapsaisie:$dist
|
||||
[ -n "$DIST" -a "$DIST" != "$dist" ] && continue
|
||||
docker build -t docker.io/brenard/ldapsaisie:$dist -f Dockerfile.$dist .
|
||||
[ $? -eq 0 ] && docker push docker.io/brenard/ldapsaisie:$dist
|
||||
done
|
||||
|
||||
docker build -t brenard/ldapsaisie:latest -f Dockerfile.$LATEST_DIST .
|
||||
[ $? -eq 0 ] && docker push brenard/ldapsaisie:latest
|
||||
[ -n "$DIST" -a "$DIST" != "latest" ] && exit
|
||||
|
||||
docker build -t docker.io/brenard/ldapsaisie:latest -f Dockerfile.$LATEST_DIST .
|
||||
[ $? -eq 0 ] && docker push docker.io/brenard/ldapsaisie:latest
|
||||
|
|
Loading…
Reference in a new issue