docker-symfony icon indicating copy to clipboard operation
docker-symfony copied to clipboard

Dockerfile reducing RUNs

Open yohancourbe opened this issue 8 years ago • 2 comments

From my understanding of Docker - I'm not a guru - each time you use a RUN command, it creates a temporary cached image. In this case, I think there are way to many RUNs

# install xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
RUN echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.idekey=\"PHPSTORM\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.remote_port=9001" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

could be written

# install xdebug
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=\"PHPSTORM\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port=9001" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

which would result in a single subimage created.

I'm keen to contribute.

cheers

yohancourbe avatar Apr 13 '17 10:04 yohancourbe

Sorry for the delay... I completely approve. Feel free to open a PR :)

maxpou avatar Apr 26 '17 16:04 maxpou

Sorry for the delay... I completely approve. Feel free to open a PR :)

Hi, @maxpou

I fixed this issue instead of @yohancourbe. So, please confirm the pull request below.

https://github.com/maxpou/docker-symfony/pull/107

s-kikuchi avatar Nov 20 '18 06:11 s-kikuchi