start_sf5_project/docker_build/php/Dockerfile

75 lines
2.0 KiB
Docker
Raw Normal View History

2021-02-18 16:46:47 +00:00
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
2017-12-27 19:03:06 +00:00
2021-02-18 16:46:47 +00:00
# Set php timezone
RUN { \
echo ""; \
echo "[Date]"; \
echo "date.timezone = Europe/Brussels"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/date.ini
# Install composer
2021-04-16 06:44:30 +00:00
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
2021-02-18 16:46:47 +00:00
2021-04-16 06:37:21 +00:00
# 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
2017-12-27 19:03:06 +00:00
2021-02-18 16:46:47 +00:00
# Add users/groups with uid 1000
RUN groupadd --gid ${GID} "group${GID}" \
&& useradd --uid ${UID} --gid ${GID} --create-home "user${UID}"
2021-02-18 17:50:06 +00:00
2021-04-16 06:44:30 +00:00
USER ${UID}
RUN git config --global user.email "docker-php-master@champs-libres.coop" \
&& git config --global user.name "Docker PHP Master"
USER root
2021-02-18 17:50:06 +00:00
WORKDIR "/var/www/app"