title: Combining php:7.2-alpine with nginx in ond Dockerfile
body: <p>I have a need to combine the php:7.2 alpine with nginx in one dockerfile( in one docker image ) for production deployment of laravel app.</p>
  
  <p>So I tried my way and I can only add nginx package. I can't find any nginx conf file in my image. I found many someone's images in docker hub. I tried a lot with this images and not working well.</p>
  
  <p>Here is my docker file.</p>
  
  <pre><code>FROM php:7.2-alpine
  
  RUN apk upgrade --update -q \
    &amp;&amp; apk --no-cache -q add openssl zip unzip git mysql-client vim coreutils freetype-dev libpng-dev libjpeg-turbo-dev freetype libpng libjpeg-turbo libltdl libmcrypt-dev \
    &amp;&amp; docker-php-ext-configure gd \
      --with-gd \
      --with-freetype-dir=/usr/include/ \
      --with-png-dir=/usr/include/ \
      --with-jpeg-dir=/usr/include/ &amp;&amp; \
    NPROC=$(grep -c ^processor /proc/cpuinfo 2&gt;/dev/null || 1) \
    &amp;&amp; docker-php-ext-install -j$(nproc) gd pdo pdo_mysql opcache zip calendar \
    &amp;&amp; apk del --no-cache -q freetype-dev libpng-dev libjpeg-turbo-dev
  
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  
  RUN apk --update add \
      supervisor
  
  RUN apk add --update nginx &amp;&amp; rm -rf /var/cache/apk/*
  RUN mkdir -p /tmp/nginx/client-body
  
  COPY nginx/nginx.conf /etc/nginx/nginx.conf
  COPY nginx/default.conf /etc/nginx/conf.d/default.conf
  #COPY website /usr/share/nginx/html
  WORKDIR /var/www
  COPY ./workspace-api /var/www
  COPY ./workspace-api/supervisord.conf /etc/supervisord.conf
  ADD ./workspace-api/root /etc/crontabs/
  ADD ./workspace-api/php.ini /usr/local/etc/php
  
  RUN composer install
  RUN chmod -R 755  /var/www
  
  
  RUN chmod +x /var/www/supervisor.sh
  RUN /var/www/supervisor.sh
  
  CMD ["nginx", "-g", "daemon off;"]
  </code></pre>
  
  <p>PS: I have docker-compose file for multi container app. But in this case, I only need to build all in one image for laravel.</p>