Skip to content

Commit

Permalink
fix error in docker-compose, reduce container size
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamdeew committed Feb 3, 2020
1 parent c6b984e commit 554aa2a
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 60 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ services:
# - ./docker/apache-php-71/config/php.ini:/usr/local/etc/php/conf.d/my.ini:ro
# - ./docker/apache-php-71/config/apache2.conf:/etc/apache2/apache2.conf:ro
# - ./docker/apache-php-71/config/sites-enabled:/etc/apache2/sites-enabled:ro
# - ./docker/php-73/composer/:/root/.composer/
# - ./docker/apache-php-71/composer/:/root/.composer/
# - ./projects/:/srv/projects/
# logging: *default-logging

Expand All @@ -131,6 +131,6 @@ services:
# - ./docker/apache-php-56/config/php.ini:/usr/local/etc/php/conf.d/my.ini:ro
# - ./docker/apache-php-56/config/apache2.conf:/etc/apache2/apache2.conf:ro
# - ./docker/apache-php-56/config/sites-enabled:/etc/apache2/sites-enabled:ro
# - ./docker/php-73/composer/:/root/.composer/
# - ./docker/apache-php-56/composer/:/root/.composer/
# - ./projects/:/srv/projects/
# logging: *default-logging
26 changes: 15 additions & 11 deletions docker/apache-php-56/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM php:5-apache
RUN apt-get update && apt-get -y install libmcrypt-dev libicu-dev wget mysql-client msmtp libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev libvpx-dev && apt-get clean
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mcrypt
RUN docker-php-ext-install opcache
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-xpm-dir=/usr/include/ --with-vpx-dir=/usr/include/
RUN docker-php-ext-install gd
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
RUN docker-php-ext-install mysql
RUN docker-php-ext-install zip
FROM php:5.6-apache
RUN apt-get update && \
apt-get -y install libmcrypt-dev libicu-dev wget mysql-client msmtp libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev libvpx-dev && \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install mcrypt && \
docker-php-ext-install opcache && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-xpm-dir=/usr/include/ --with-vpx-dir=/usr/include/ && \
docker-php-ext-install gd && \
docker-php-ext-install mysql && \
docker-php-ext-install zip && \
apt-get remove -y libmcrypt-dev libicu-dev libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev libvpx-dev gcc gcc-6 && \
apt-get autoremove -y && apt-get clean && rm -rf /usr/src/*

RUN (cd /etc/apache2/mods-enabled && ln -s ../mods-available/rewrite.load .)
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
25 changes: 14 additions & 11 deletions docker/apache-php-71/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM php:7.1-apache
RUN apt-get update && apt-get -y install libmcrypt-dev libicu-dev libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev wget mysql-client && apt-get clean
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mcrypt
RUN docker-php-ext-install opcache
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-xpm-dir=/usr/include/
RUN docker-php-ext-install gd
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install zip
RUN apt-get update && \
apt-get -y install libmcrypt-dev libicu-dev libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev wget mariadb-client msmtp && \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install mcrypt && \
docker-php-ext-install opcache && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-xpm-dir=/usr/include/ && \
docker-php-ext-install gd && \
docker-php-ext-install mysqli && \
docker-php-ext-install zip && \
apt-get remove -y libmcrypt-dev libicu-dev libpng-dev libjpeg-dev libfreetype6-dev libxpm-dev gcc gcc-8 && \
apt-get autoremove -y && apt-get clean && rm -rf /usr/src/*

RUN (cd /etc/apache2/mods-enabled && ln -s ../mods-available/rewrite.load .)
RUN apt-get update && apt-get -y install msmtp && apt-get clean
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
43 changes: 25 additions & 18 deletions docker/php-71/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
FROM php:7.1-fpm-alpine
RUN apk add --no-cache icu-dev icu-libs icu msmtp git vim mysql-client zlib zlib-dev \
ssmtp g++ make automake bash libpng-dev autoconf shadow libzip-dev
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
RUN apk add --no-cache mysql-client msmtp perl wget procps

ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv && \
apk add --no-cache --virtual build-essentials \
icu-dev icu-libs zlib-dev g++ make automake autoconf shadow libzip-dev \
libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install intl
RUN docker-php-ext-install opcache
RUN docker-php-ext-install exif
RUN docker-php-ext-install zip
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv
RUN docker-php-ext-install iconv
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
docker-php-ext-install gd && \
docker-php-ext-install mysqli && \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install intl && \
docker-php-ext-install opcache && \
docker-php-ext-install exif && \
docker-php-ext-install zip && \
apk del build-essentials && rm -rf /usr/src/php*

RUN wget https://github.com/composer/composer/releases/download/1.9.2/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer

RUN wget http://mysqltuner.pl/ -O /opt/mysqltuner && \
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O /opt/basic_passwords.txt && \
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O /opt/vulnerabilities.csv && \
chmod +x /opt/mysqltuner

#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
41 changes: 23 additions & 18 deletions docker/php-72/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
FROM php:7.2-fpm-alpine3.11
RUN apk add --no-cache icu-dev icu-libs icu msmtp git vim mysql-client zlib zlib-dev \
ssmtp g++ make automake bash libpng-dev autoconf shadow libzip-dev
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
RUN apk add --no-cache mysql-client msmtp perl wget procps

RUN apk add --no-cache --virtual build-essentials \
icu-dev icu-libs zlib-dev g++ make automake autoconf shadow libzip-dev \
libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install intl
RUN docker-php-ext-install opcache
RUN docker-php-ext-install exif
RUN docker-php-ext-install zip
RUN wget https://github.com/composer/composer/releases/download/1.8.6/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv
RUN docker-php-ext-install iconv
#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data
docker-php-ext-install gd && \
docker-php-ext-install mysqli && \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install intl && \
docker-php-ext-install opcache && \
docker-php-ext-install exif && \
docker-php-ext-install zip && \
apk del build-essentials && rm -rf /usr/src/php*

RUN wget https://github.com/composer/composer/releases/download/1.9.2/composer.phar -O /usr/local/bin/composer && chmod +x /usr/local/bin/composer

RUN wget http://mysqltuner.pl/ -O /opt/mysqltuner && \
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O /opt/basic_passwords.txt && \
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O /opt/vulnerabilities.csv && \
chmod +x /opt/mysqltuner

#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data

0 comments on commit 554aa2a

Please sign in to comment.