Dockerfile 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. FROM ubuntu:jammy
  2. ARG DEBIAN_FRONTEND=noninteractive
  3. # PHP
  4. RUN apt-get update -y && \
  5. apt install -y apache2 vim software-properties-common sudo nano gnupg2
  6. RUN apt-get install --no-install-recommends -y \
  7. php8.1 \
  8. php8.1-common \
  9. php8.1-gd \
  10. php8.1-zip \
  11. php8.1-curl \
  12. php8.1-xml \
  13. php8.1-xmlrpc \
  14. php8.1-mbstring \
  15. php8.1-sqlite \
  16. php8.1-xdebug \
  17. php8.1-pgsql \
  18. php8.1-intl \
  19. php8.1-imagick \
  20. php8.1-gmp \
  21. php8.1-apcu \
  22. php8.1-bcmath \
  23. php8.1-redis \
  24. php8.1-soap \
  25. php8.1-imap \
  26. php8.1-opcache \
  27. php8.1-cli \
  28. php8.1-dev \
  29. libmagickcore-6.q16-3-extra \
  30. curl \
  31. lsof \
  32. make \
  33. unzip
  34. # Composer
  35. RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php && \
  36. curl -sS https://composer.github.io/installer.sig -o /tmp/composer-setup.sig && \
  37. php -r "if (hash_file('sha384', '/tmp/composer-setup.php') !== trim(file_get_contents('/tmp/composer-setup.sig'))) { echo 'Composer installation failed, invalid hash'; exit(1); }" && \
  38. php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
  39. rm /tmp/composer-setup.php /tmp/composer-setup.sig
  40. RUN echo "xdebug.remote_enable = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini && \
  41. echo "xdebug.remote_autostart = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini && \
  42. echo "apc.enable_cli=1" >> /etc/php/8.1/cli/conf.d/20-apcu.ini
  43. # Autostart XDebug for apache
  44. RUN { \
  45. echo "xdebug.mode=debug"; \
  46. echo "xdebug.start_with_request=yes"; \
  47. } >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini
  48. # Docker
  49. RUN apt-get -y install \
  50. apt-transport-https \
  51. ca-certificates \
  52. curl \
  53. gnupg-agent \
  54. software-properties-common && \
  55. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
  56. add-apt-repository \
  57. "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  58. $(lsb_release -cs) \
  59. stable" && \
  60. apt-get update -y && \
  61. apt-get install -y docker-ce docker-ce-cli containerd.io && \
  62. ln -s /var/run/docker-host.sock /var/run/docker.sock
  63. # Dedicated DevContainer user runs Apache
  64. ENV APACHE_RUN_USER=devcontainer
  65. ENV APACHE_RUN_GROUP=devcontainer
  66. RUN useradd -ms /bin/bash ${APACHE_RUN_USER} && \
  67. adduser ${APACHE_RUN_USER} sudo && \
  68. echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
  69. sed -ri "s/^export APACHE_RUN_USER=.*$/export APACHE_RUN_USER=${APACHE_RUN_USER}/" "/etc/apache2/envvars" && \
  70. sed -ri "s/^export APACHE_RUN_GROUP=.*$/export APACHE_RUN_GROUP=${APACHE_RUN_GROUP}/" "/etc/apache2/envvars"
  71. USER devcontainer
  72. # NVM
  73. RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
  74. RUN bash --login -i -c 'source /home/devcontainer/.bashrc && nvm install 16'
  75. WORKDIR /var/www/html