Skip to content

Instantly share code, notes, and snippets.

@zabaala
Created April 20, 2020 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zabaala/c92bfbb2c48ef88f0679c096ecc4d0e0 to your computer and use it in GitHub Desktop.
Save zabaala/c92bfbb2c48ef88f0679c096ecc4d0e0 to your computer and use it in GitHub Desktop.
Utils docker image
FROM ubuntu:16.04
LABEL maintainer="Mauricio Rodrigues <mmauricio.vsr@gmail.com>"
RUN echo "----> Upgrading repository" && \
apt-get update -y && \
apt-get upgrade -y && \
apt-get upgrade -y && \
apt-get install -y apt-transport-https \
curl \
libxrender1 \
libfontconfig1 \
libxext6 \
wget \
nano \
vim \
git \
sudo && \
echo "---> Preparing and Installing PHP" && \
apt-get update -y && \
apt-get -y install \
#php7.0-apcu \
php7.0-bcmath \
php7.0-bz2 \
php7.0-cli \
php7.0-curl \
php7.0-fpm \
php7.0-gd \
#php7.0-imagick \
php7.0-imap \
php7.0-intl \
php7.0-json \
php7.0-mbstring \
php7.0-mcrypt \
php7.0-mysql \
#php7.0-mongodb \
php7.0-opcache \
php7.0-pgsql \
#php7.0-redis \
php7.0-soap \
php7.0-sqlite3 \
#php7.0-xdebug \
php7.0-xml \
php7.0-zip \
php7.0-phpdbg && \
echo "---> Installing Composer" && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
echo "---> Cleaning up" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* && \
echo "---> Adding the php-user" && \
adduser --disabled-password --gecos "" php-user && \
mkdir -p /var/www/app && \
chown -R php-user:php-user /var/www && \
chown -R php-user:php-user /home/php-user && \
echo "---> Configuring PHP" && \
echo "php-user ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers && \
sed -i "/user = .*/c\user = php-user" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/^group = .*/c\group = php-user" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/listen.owner = .*/c\listen.owner = php-user" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/listen.group = .*/c\listen.group = php-user" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/listen = .*/c\listen = [::]:9000" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/;access.log = .*/c\access.log = /proc/self/fd/2" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/;clear_env = .*/c\clear_env = no" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/;catch_workers_output = .*/c\catch_workers_output = yes" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i "/pid = .*/c\;pid = /run/php/php7.0-fpm.pid" /etc/php/7.0/fpm/php-fpm.conf && \
sed -i "/;daemonize = .*/c\daemonize = yes" /etc/php/7.0/fpm/php-fpm.conf && \
sed -i "/error_log = .*/c\error_log = /proc/self/fd/2" /etc/php/7.0/fpm/php-fpm.conf && \
sed -i "/post_max_size = .*/c\post_max_size = 1000M" /etc/php/7.0/fpm/php.ini && \
sed -i "/upload_max_filesize = .*/c\upload_max_filesize = 1000M" /etc/php/7.0/fpm/php.ini
# sed -i "/zend_extension=xdebug.so/c\;zend_extension=xdebug.so" /etc/php/7.0/mods-available/xdebug.ini
# Define the running user
USER php-user
# Application directory
WORKDIR "/var/www/app"
ENV PATH=/home/php-user/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment