start_sf5_project_reboot/docker_build/php/Dockerfile

75 lines
2.0 KiB
Docker

FROM php:7.3-fpm-buster
# Set the lifetime of a PHP session
ARG SESSION_LIFETIME=10800
# Set default UID for the PHP user
ARG UID=1000
ARG GID=1000
# Install postgresql client
# and compile docker php extensions
RUN apt update \
&& apt -y --no-install-recommends install \
wget \
gnupg \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt update \
&& apt -y --no-install-recommends install \
libicu-dev \
g++ \
libzip-dev \
libzip4 \
unzip \
libfreetype6-dev \
libpng-dev \
libjpeg62-turbo-dev \
libpq5 \
libpq-dev \
postgresql-12 \
git \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install intl pdo_pgsql mbstring zip bcmath sockets exif \
&& apt remove -y \
wget \
gnupg \
libicu-dev \
g++ \
libzip-dev \
libpq-dev \
&& apt autoremove -y \
&& apt purge -y
# Set php timezone
RUN { \
echo ""; \
echo "[Date]"; \
echo "date.timezone = Europe/Brussels"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/date.ini
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Symfony installer
RUN curl -sS https://get.symfony.com/cli/installer -o /usr/local/bin/installer | bash \
&& chmod a+x /usr/local/bin/installer \
&& /usr/local/bin/installer \
&& mv /root/.symfony/bin/symfony /usr/local/bin/symfony \
&& chmod a+x /usr/local/bin/symfony
# Add users/groups with uid 1000
RUN groupadd --gid ${GID} "group${GID}" \
&& useradd --uid ${UID} --gid ${GID} --create-home "user${UID}"
USER ${UID}
RUN git config --global user.email "docker-php-master@champs-libres.coop" \
&& git config --global user.name "Docker PHP Master"
USER root
WORKDIR "/var/www/app"