Skip to content

Instantly share code, notes, and snippets.

@thureos
Created December 17, 2021 13:58
Show Gist options
  • Save thureos/af37f8c1acff2c59cbb5ca9faab1d1dc to your computer and use it in GitHub Desktop.
Save thureos/af37f8c1acff2c59cbb5ca9faab1d1dc to your computer and use it in GitHub Desktop.
FROM php:7.3-apache-stretch
ARG UID
ARG GID
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
#Recreates the user www-data with the current user's id and group id
RUN if [ ${UID:-0} -ne 0 ] && [ ${GID:-0} -ne 0 ]; then \
userdel -f www-data &&\
if getent group www-data ; then groupdel www-data; fi &&\
groupadd -g ${GID} www-data &&\
useradd -l -u ${UID} -g www-data www-data \
;fi
# Node with npm
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
#Install PHP Extensions ( PGSQL )
# Make sure to add any aditional needed dependencies here
RUN apt-get install -y --no-install-recommends \
git \
zip \
unzip \
bash \
zlib1g-dev \
libzip-dev \
nodejs \
autoconf \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
nano \
htop \
libmongoc-1.0.0 \
libcurl4-openssl-dev \
libssl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install bcmath pdo_mysql zip pcntl
# RUN pecl install mongodb
RUN pecl install redis
# RUN echo "extension=mongodb.so" >> /usr/local/etc/php/php.ini
RUN echo "extension=redis.so" >> /usr/local/etc/php/php.ini
RUN echo "memory_limit=1024M" >> /usr/local/etc/php/php.ini
RUN echo "upload_max_filesize=50M" >> /usr/local/etc/php/php.ini
RUN echo "post_max_size=50M" >> /usr/local/etc/php/php.ini
RUN echo "date.timezone=\"America/New_York\"" >> /usr/local/etc/php/php.ini
RUN echo "max_execution_time=601" >> /usr/local/etc/php/php.ini
RUN echo "max_input_time=601" >> /usr/local/etc/php/php.ini
# RUN service apache2 restart
RUN \
cd /usr/bin \
&& php -r "copy('https://getcomposer.org/installer', '/usr/bin/composer-setup.php');" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& ln -s composer.phar composer
RUN a2enmod rewrite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment