Dockerfile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM php:8.1-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-5.3.7 && \
  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. COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini
  28. # COPY ./php-fpm-custom.conf /usr/local/etc/php-fpm.d/php-fpm-custom.conf
  29. ARG USER_UID
  30. ARG USER_UNAME
  31. ARG USER_GID
  32. ARG USER_GNAME
  33. RUN if getent group ${USER_GNAME} ; then groupdel ${USER_GNAME}; fi &&\
  34. groupadd -g ${USER_GID} ${USER_GNAME} &&\
  35. useradd -l -u ${USER_UID} -g ${USER_GNAME} ${USER_UNAME} &&\
  36. echo ${USER_UNAME}:${USER_UNAME} | chpasswd &&\
  37. install -d -m 0755 -o ${USER_UNAME} -g ${USER_GNAME} /home/${USER_UNAME} &&\
  38. chown --changes --silent --no-dereference --recursive \
  39. --from=33:33 ${USER_UID}:${USER_GID} \
  40. /home/${USER_UNAME}
  41. # /.composer \
  42. # /var/run/php-fpm \
  43. # /var/lib/php/sessions \
  44. COPY ./bashrc /home/${USER_UNAME}/.bashrc
  45. COPY ./inputrc /home/${USER_UNAME}/.inputrc
  46. # https://stackoverflow.com/questions/36964652/ssh-in-docker-container-causes-http-404
  47. # use \n to make the content into multiple lines
  48. # RUN printf "whoami\nphp-fpm -D\n/usr/sbin/sshd -D" >> /start.sh
  49. # RUN chmod +x /start.sh
  50. # CMD ["/start.sh"]
  51. # USER ${USER_UNAME}