Dockerfile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM php:7.2-fpm
  2. # Copy composer.lock and composer.json
  3. COPY composer.lock composer.json /var/www/
  4. # Set working directory
  5. WORKDIR /var/www
  6. # Install dependencies
  7. RUN apt-get update && apt-get install -y \
  8. build-essential \
  9. mysql-client \
  10. libpng-dev \
  11. libjpeg62-turbo-dev \
  12. libfreetype6-dev \
  13. locales \
  14. zip \
  15. jpegoptim optipng pngquant gifsicle \
  16. vim \
  17. unzip \
  18. git \
  19. curl \
  20. gnupg
  21. # Clear cache
  22. RUN apt-get clean && rm -rf /var/lib/apt/lists/*
  23. # Install extensions
  24. RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
  25. RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
  26. RUN docker-php-ext-install gd
  27. # Install composer
  28. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  29. # Install NodeJs
  30. RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
  31. RUN apt-get install -y nodejs
  32. # Copy existing application directory contents
  33. COPY . /var/www
  34. # Add user for laravel application
  35. RUN groupadd -g 1000 hd
  36. RUN useradd -u 1000 -ms /bin/bash -g hd hd
  37. # Copy existing application directory permissions
  38. COPY --chown=hd:hd . /var/www
  39. ## Install xdebug
  40. RUN yes | pecl install xdebug \
  41. && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
  42. && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
  43. && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
  44. # Change current user to www
  45. USER hd
  46. # Expose port 9000 and start php-fpm server
  47. EXPOSE 9000
  48. CMD ["php-fpm"]