Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. # Clear cache
  21. RUN apt-get clean && rm -rf /var/lib/apt/lists/*
  22. # Install extensions
  23. RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
  24. RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
  25. RUN docker-php-ext-install gd
  26. # Install composer
  27. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  28. # Add user for laravel application
  29. RUN groupadd -g 1000 www
  30. RUN useradd -u 1000 -ms /bin/bash -g www www
  31. # Copy existing application directory contents
  32. COPY . /var/www
  33. # Copy existing application directory permissions
  34. COPY --chown=www:www . /var/www
  35. # Change current user to www
  36. USER www
  37. # Expose port 9000 and start php-fpm server
  38. EXPOSE 9000
  39. CMD ["php-fpm"]