Advertisement
iruindegi

aurki2de dockerfile

Aug 8th, 2023
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. FROM php:8.2-fpm-alpine3.16
  2.  
  3. RUN echo "Europe/Madrid" > /etc/timezone
  4.  
  5. # 2 Set working directory
  6. WORKDIR /usr/src/app
  7.  
  8. # 3 Install Additional dependencies
  9. RUN apk update && apk add --no-cache \
  10. build-base shadow vim curl bash \
  11. zip libzip-dev \
  12. libicu-dev \
  13. libjpeg-turbo-dev \
  14. libpng-dev \
  15. libwebp-dev \
  16. freetype-dev \
  17. git\
  18. autoconf
  19.  
  20. # 4 Add and Enable PHP-PDO Extenstions
  21. RUN docker-php-ext-install pdo pdo_mysql mysqli
  22. RUN docker-php-ext-enable pdo_mysql opcache
  23. RUN docker-php-ext-install zip
  24. RUN docker-php-ext-enable zip
  25. RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype
  26. RUN docker-php-ext-install gd
  27. RUN docker-php-ext-configure intl && docker-php-ext-install intl
  28. RUN docker-php-ext-enable gd intl
  29.  
  30. # ldap
  31. RUN apk add --update --no-cache \
  32. libldap && \
  33. # Build dependancy for ldap \
  34. apk add --update --no-cache --virtual .docker-php-ldap-dependancies \
  35. openldap-dev && \
  36. docker-php-ext-configure ldap && \
  37. docker-php-ext-install ldap && \
  38. apk del .docker-php-ldap-dependancies && \
  39. php -m;
  40.  
  41. RUN pecl install -o -f redis apcu \
  42. && rm -rf /tmp/pear \
  43. && docker-php-ext-enable redis apcu
  44.  
  45. RUN apk --no-cache add nodejs yarn npm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
  46.  
  47. WORKDIR /usr/src/app/var/keys
  48. RUN openssl genrsa -out private.key 2048
  49. RUN openssl rsa -in private.key -pubout -out public.key
  50. WORKDIR /usr/src/app
  51.  
  52. # 5 Install PHP Composer
  53. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  54.  
  55. # 6 Remove Cache
  56. RUN rm -rf /var/cache/apk/*
  57.  
  58. WORKDIR /usr/src/app
  59.  
  60. # 8 Copy existing application directory permissions
  61. COPY . /usr/src/app
  62.  
  63. RUN composer install --no-scripts --prefer-dist --no-interaction --optimize-autoloader --env=prod
  64. RUN php bin/console cache:clear --env=prod
  65.  
  66. RUN rm -fr node_modules && yarn install && yarn build
  67.  
  68. # 9 Change current user
  69. USER www-data
  70. # 10 Expose port 9000 and start php-fpm server
  71. EXPOSE 9000
  72. CMD ["php-fpm"]
  73.  
  74.  
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement