|
| 1 | +FROM php:8.5-fpm-bookworm |
| 2 | + |
| 3 | +ARG TIME_ZONE=Pacific/Auckland |
| 4 | + |
| 5 | +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| 6 | + apt-transport-https \ |
| 7 | + libfreetype6-dev \ |
| 8 | + libjpeg62-turbo-dev \ |
| 9 | + libwebp-dev \ |
| 10 | + libmcrypt-dev \ |
| 11 | + libpng-dev \ |
| 12 | + libxml2-dev \ |
| 13 | + libicu-dev \ |
| 14 | + libpq-dev \ |
| 15 | + gnupg2 \ |
| 16 | + cron \ |
| 17 | + nano \ |
| 18 | + vim \ |
| 19 | + wget \ |
| 20 | + openssl \ |
| 21 | + locales \ |
| 22 | + tzdata \ |
| 23 | + git \ |
| 24 | + libzip-dev \ |
| 25 | + libmemcached-dev \ |
| 26 | + zip \ |
| 27 | + netcat-traditional \ |
| 28 | + bc \ |
| 29 | + ghostscript \ |
| 30 | + graphviz \ |
| 31 | + aspell \ |
| 32 | + libldap2-dev \ |
| 33 | + libltdl-dev \ |
| 34 | + libc-client-dev \ |
| 35 | + libkrb5-dev \ |
| 36 | + libssl-dev \ |
| 37 | + libpspell-dev \ |
| 38 | + xmlstarlet \ |
| 39 | + libtool \ |
| 40 | + bison |
| 41 | + |
| 42 | +COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie |
| 43 | + |
| 44 | +RUN docker-php-ext-install -j$(nproc) \ |
| 45 | + zip \ |
| 46 | + intl \ |
| 47 | + soap \ |
| 48 | + pdo_pgsql \ |
| 49 | + pdo_mysql \ |
| 50 | + pgsql \ |
| 51 | + mysqli \ |
| 52 | + exif \ |
| 53 | + ldap \ |
| 54 | + && docker-php-ext-configure gd \ |
| 55 | + --with-freetype \ |
| 56 | + --with-jpeg \ |
| 57 | + --with-webp \ |
| 58 | + && docker-php-ext-install -j$(nproc) gd |
| 59 | + |
| 60 | +RUN git clone https://github.com/longxinH/xhprof.git ./xhprof \ |
| 61 | + && cd xhprof \ |
| 62 | + && git checkout v2.3.10 \ |
| 63 | + && cd extension/ \ |
| 64 | + && phpize \ |
| 65 | + && ./configure \ |
| 66 | + && make && make install |
| 67 | + |
| 68 | +RUN echo "extension=xhprof.so" >> /usr/local/etc/php/conf.d/xhprof.ini \ |
| 69 | + && echo "xhprof.output_dir = /tmp/xhprof" >> /usr/local/etc/php/conf.d/xhprof.ini |
| 70 | + |
| 71 | +RUN pecl channel-update pecl.php.net && \ |
| 72 | + pecl install -o -f redis \ |
| 73 | + && rm -rf /tmp/pear \ |
| 74 | + && docker-php-ext-enable redis |
| 75 | + |
| 76 | +# TODO: uncomment when igbinary supports PHP 8.5 https://pecl.php.net/package/igbinary |
| 77 | +# RUN pecl channel-update pecl.php.net && \ |
| 78 | +# pecl install -o -f igbinary \ |
| 79 | +# && rm -rf /tmp/pear \ |
| 80 | +# && docker-php-ext-enable igbinary |
| 81 | + |
| 82 | +RUN pecl channel-update pecl.php.net && \ |
| 83 | + pecl install -o -f memcached \ |
| 84 | + && rm -rf /tmp/pear \ |
| 85 | + && docker-php-ext-enable memcached |
| 86 | + |
| 87 | +RUN pecl channel-update pecl.php.net && \ |
| 88 | + pecl install -o -f imap \ |
| 89 | + && rm -rf /tmp/pear \ |
| 90 | + && docker-php-ext-enable imap |
| 91 | + |
| 92 | +RUN pecl channel-update pecl.php.net && \ |
| 93 | + pecl install -o -f excimer \ |
| 94 | + && rm -rf /tmp/pear \ |
| 95 | + && docker-php-ext-enable excimer |
| 96 | + |
| 97 | +RUN pecl channel-update pecl.php.net && \ |
| 98 | + pecl install -o -f pspell \ |
| 99 | + && rm -rf /tmp/pear \ |
| 100 | + && docker-php-ext-enable pspell |
| 101 | + |
| 102 | +# TODO: switch to non alpha when xdebug supports PHP 8.5 https://xdebug.org/announcements/2025-11-12 |
| 103 | +RUN pie install xdebug/xdebug:3.5.0alpha3 |
| 104 | + |
| 105 | +RUN pecl channel-update pecl.php.net && \ |
| 106 | + pecl install -o -f pcov \ |
| 107 | + && rm -rf /tmp/pear \ |
| 108 | + && docker-php-ext-enable pcov |
| 109 | + |
| 110 | +# Install composer |
| 111 | +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer |
| 112 | + |
| 113 | +# we need en_US locales for MSSQL connection to work |
| 114 | +# we need en_AU locales for behat to work |
| 115 | +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ |
| 116 | + sed -i -e 's/# en_AU.UTF-8 UTF-8/en_AU.UTF-8 UTF-8/' /etc/locale.gen && \ |
| 117 | + dpkg-reconfigure --frontend=noninteractive locales && \ |
| 118 | + update-locale LANG=en_US.UTF-8 |
| 119 | + |
| 120 | +ENV LANG=en_US.UTF-8 |
| 121 | +ENV LANGUAGE=en_US.UTF-8 |
| 122 | +ENV LC_ALL=en_US.UTF-8 |
| 123 | + |
| 124 | +# install mssql extension |
| 125 | +RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ |
| 126 | + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ |
| 127 | + && apt-get update && ACCEPT_EULA=Y apt-get install -y \ |
| 128 | + msodbcsql18 \ |
| 129 | + mssql-tools18 \ |
| 130 | + unixodbc-dev |
| 131 | + |
| 132 | +RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \ |
| 133 | + && echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc |
| 134 | + |
| 135 | +# TODO: uncomment when sqlsrv supports PHP 8.5 https://github.com/microsoft/msphpsql/releases |
| 136 | +# Workaround applied: https://github.com/microsoft/msphpsql/issues/1438#issuecomment-1444773949 |
| 137 | +# RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \ |
| 138 | +# && pecl install sqlsrv-5.12.0 pdo_sqlsrv-5.12.0 || \ |
| 139 | +# apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 && \ |
| 140 | +# pecl install sqlsrv-5.12.0 pdo_sqlsrv-5.12.0 |
| 141 | + |
| 142 | +# RUN docker-php-ext-enable sqlsrv.so && docker-php-ext-enable pdo_sqlsrv.so |
| 143 | + |
| 144 | +RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \ |
| 145 | + && dpkg-reconfigure --frontend noninteractive tzdata |
| 146 | + |
| 147 | +COPY config/php.ini /usr/local/etc/php/ |
| 148 | +COPY config/fpm.conf /usr/local/etc/php-fpm.d/zz-totara.conf |
| 149 | + |
| 150 | +# Source each .sh file found in the /shell/ folder, always source the default_aliases.sh file first |
| 151 | +RUN echo 'if [[ -e "/root/custom_shell/default-aliases.sh" ]]; then source "/root/custom_shell/default-aliases.sh"; fi' >> ~/.bashrc && \ |
| 152 | + echo 'for f in /root/custom_shell/*.sh; do [[ "$f" != "/root/custom_shell/default-aliases.sh" && -e "$f" ]] && source "$f"; done;' >> ~/.bashrc |
| 153 | + |
| 154 | +# Have the option of using the oh my zsh shell. |
| 155 | +RUN apt-get update && apt-get install -y zsh |
| 156 | +RUN sh -c "$(curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended |
| 157 | +RUN git clone https://github.com/romkatv/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k |
| 158 | +RUN git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions |
| 159 | +RUN git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions |
| 160 | +RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting |
| 161 | +RUN echo 'setopt +o nomatch' > ~/.zshrc |
| 162 | +RUN echo 'source ~/custom_shell/.zshrc' >> ~/.zshrc |
| 163 | +RUN cat ~/.bashrc >> ~/.zshrc |
| 164 | + |
| 165 | +COPY entrypoint.sh /entrypoint.sh |
| 166 | +RUN chmod +x /entrypoint.sh |
| 167 | +ENTRYPOINT [ "/entrypoint.sh" ] |
0 commit comments