hydra-sql/misc/compose/hydra-sql/Dockerfile

120 lines
3.4 KiB
Docker

FROM ubuntu:22.04
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG http_proxy=
ARG https_proxy=
ENV WAITFORIT_VERSION="v2.4.1"
ARG PHP_VERSION="8.1"
ENV PHP_VERSION $PHP_VERSION
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:ondrej/php && \
apt-get update -y && \
apt-get install -y --no-install-recommends \
git bash wget ca-certificates supervisor cron rsyslog mysql-client jq \
mutt tree vim python3-setuptools python3-pip make \
php${PHP_VERSION}-cli php${PHP_VERSION}-ldap php${PHP_VERSION}-soap \
php${PHP_VERSION}-intl php${PHP_VERSION}-curl php${PHP_VERSION}-gd \
php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \
php${PHP_VERSION}-zip php${PHP_VERSION}-fpm \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-pgsql \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-pdo-pgsql \
php${PHP_VERSION}-pdo-mysql \
php${PHP_VERSION}-ssh2 libxml2-utils \
locales \
apache2 \
libapache2-mod-fcgid \
ssh-client \
acl moreutils \
sudo
# Set fr_FR locale
RUN sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=fr_FR.UTF-8
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8
# Install NodeJS
RUN wget -O- https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install nodemon -g
# Waitforit - Wait for all service is running before launch tests
RUN wget -q -O /usr/local/bin/waitforit https://github.com/maxcnunes/waitforit/releases/download/$WAITFORIT_VERSION/waitforit-linux_amd64 \
&& chmod +x /usr/local/bin/waitforit
# Install superfsmon to restart supervisor programs on file changes
RUN pip3 install wheel superfsmon
VOLUME /var/www
VOLUME /var/www/var/logs
VOLUME /var/www/var/cache
# Install composer
COPY install-composer.sh /var/www/install-composer.sh
RUN chmod +x /var/www/install-composer.sh &&\
/var/www/install-composer.sh &&\
rm -f /var/www/install-composer.sh
# On active les mods d'apache nécessaires
RUN a2enmod rewrite
RUN a2enmod proxy_fcgi setenvif
RUN a2enconf php8.1-fpm
RUN a2enmod proxy
RUN a2enmod expires
RUN a2enmod headers
# On injecte les bonnes configs apache et php-fpm
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
COPY www.conf /etc/php/8.1/fpm/pool.d/www.conf
EXPOSE 5000
EXPOSE 80
WORKDIR /var/www
# On démarre php-fpm une fois pour créer les sockets
RUN service php8.1-fpm start
RUN service php8.1-fpm stop
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY first-run.sh /root/first-run.sh
RUN chmod +x /root/first-run.sh
# Disable rsyslog privileges drop to allow stdout logging
RUN sed -i 's/^\$\(PrivDropTo.*\)$/#\1/' /etc/rsyslog.conf
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
COPY rsyslog.conf /etc/rsyslog.d/var/www.conf
COPY supervisor.ini /etc/supervisor/supervisor.ini
COPY php.ini /etc/php/8.1/fpm/php.ini
VOLUME /container-lifecycle
RUN wget -O- https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - \
&& chown root:root /usr/local/bin/fixuid \
&& chmod 4755 /usr/local/bin/fixuid \
&& mkdir -p /etc/fixuid
COPY fixuid.yml /etc/fixuid/config.yml
ENTRYPOINT ["/usr/local/bin/fixuid"]
RUN echo "www-data ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/www-data
USER www-data
CMD ["/docker-entrypoint.sh"]