Guest User

php.dockerfile

a guest
Sep 4th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. FROM php:7.4-fpm
  2.  
  3. # Copy composer.lock and composer.json
  4. COPY composer.lock composer.json /var/www/html/
  5.  
  6. # Set working directory
  7. WORKDIR /var/www/html
  8.  
  9. # Install dependencies
  10. RUN apt-get update && apt-get install -y \
  11. apt-utils \
  12. build-essential \
  13. libpng-dev \
  14. libjpeg62-turbo-dev \
  15. libfreetype6-dev \
  16. libzip-dev \
  17. locales \
  18. zip \
  19. jpegoptim optipng pngquant gifsicle \
  20. vim \
  21. libonig-dev \
  22. unzip \
  23. git \
  24. curl
  25.  
  26. # Clear cache
  27. RUN apt-get clean && rm -rf /var/lib/apt/lists/*
  28.  
  29. # Install extensions
  30. RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
  31. RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
  32.  
  33. RUN docker-php-ext-install gd
  34.  
  35. # Install composer
  36. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  37.  
  38. # Add user for laravel application
  39. RUN groupadd -g 1000 www
  40. RUN useradd -u 1000 -ms /bin/bash -g www www
  41.  
  42. # Copy existing application directory contents
  43. COPY . /var/www/html
  44.  
  45. # Copy existing application directory permissions
  46. COPY --chown=www:www . /var/www/html
  47.  
  48. # Change current user to www
  49. USER www
  50.  
  51. # Expose port 9000 and start php-fpm server
  52. EXPOSE 9000
Add Comment
Please, Sign In to add comment