Dockerfile 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. FROM php:7.4-fpm
  2. RUN apt-get update && apt-get install -y \
  3. libfreetype6-dev \
  4. libjpeg62-turbo-dev \
  5. libmcrypt-dev \
  6. libpng-dev \
  7. default-mysql-client \
  8. zip \
  9. net-tools iproute2 \
  10. libzip-dev && \
  11. cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini && \
  12. # docker-php-ext-install -j$(nproc) iconv && \
  13. docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
  14. apt-get install -y imagemagick libmagickwand-dev && \
  15. pecl install imagick && docker-php-ext-enable imagick && \
  16. docker-php-ext-install -j$(nproc) gd && \
  17. docker-php-ext-install pdo_mysql zip && \
  18. docker-php-ext-install opcache && \
  19. docker-php-ext-install bcmath && \
  20. apt-get install -y git vim && \
  21. pecl install redis-4.3.0 && \
  22. pecl install xdebug-3.1.3 && \
  23. docker-php-ext-enable redis xdebug
  24. RUN export COMPOSER_HOME=/usr/local/composer && \
  25. curl -sS https://getcomposer.org/installer \
  26. | php -- --install-dir=/usr/local/bin --filename=composer && \
  27. curl https://drupalconsole.com/installer \
  28. -L -o /usr/local/bin/drupal && \
  29. chmod +x /usr/local/bin/drupal && \
  30. curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar \
  31. -L -o /usr/local/bin/drush && \
  32. chmod +x /usr/local/bin/drush
  33. # todo this is not building any more, do i really need this ? (22-10-2021)
  34. # RUN apt-get install -y curl && \
  35. # curl -sL https://deb.nodesource.com/setup_11.x | bash - && \
  36. # curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
  37. # echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
  38. # apt-get update && \
  39. # apt-get install -y nodejs yarn
  40. RUN apt-get install -y rsyslog
  41. COPY ./rsyslog-drupal.conf /etc/rsyslog.d/drupal.conf
  42. # ENTRYPOINT ["sh", "-c", "service rsyslog start ; tail -f /dev/null"]
  43. COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini
  44. # COPY ./php-fpm-custom.conf /usr/local/etc/php-fpm.d/php-fpm-custom.conf
  45. ARG USER_UID
  46. ARG USER_UNAME
  47. ARG USER_GID
  48. ARG USER_GNAME
  49. RUN if getent group ${USER_GNAME} ; then groupdel ${USER_GNAME}; fi &&\
  50. groupadd -g ${USER_GID} ${USER_GNAME} &&\
  51. useradd -l -u ${USER_UID} -g ${USER_GNAME} ${USER_UNAME} &&\
  52. echo ${USER_UNAME}:${USER_UNAME} | chpasswd &&\
  53. install -d -m 0755 -o ${USER_UNAME} -g ${USER_GNAME} /home/${USER_UNAME} &&\
  54. chown --changes --silent --no-dereference --recursive \
  55. --from=33:33 ${USER_UID}:${USER_GID} \
  56. /home/${USER_UNAME}
  57. # /.composer \
  58. # /var/run/php-fpm \
  59. # /var/lib/php/sessions \
  60. COPY ./bashrc /home/${USER_UNAME}/.bashrc
  61. COPY ./inputrc /home/${USER_UNAME}/.inputrc
  62. # https://dev.to/s1ntaxe770r/how-to-setup-ssh-within-a-docker-container-i5i
  63. RUN apt-get install -y openssh-server openssh-client
  64. # RUN service ssh enable
  65. RUN service ssh start
  66. # as sshd will be launchd as ${USER_UNAME}
  67. RUN chown -R ${USER_UNAME} /etc/ssh
  68. EXPOSE 22
  69. # CMD ["/usr/sbin/sshd","-D"]
  70. # https://stackoverflow.com/questions/36964652/ssh-in-docker-container-causes-http-404
  71. # use \n to make the content into multiple lines
  72. RUN printf "whoami\nphp-fpm -D\n/usr/sbin/sshd -D" >> /start.sh
  73. RUN chmod +x /start.sh
  74. CMD ["/start.sh"]
  75. # USER ${USER_UNAME}