|
| 1 | +FROM php:8.2-apache-buster |
| 2 | + |
| 3 | +# So we can use it anywhere for conditional stuff. Keeping BC with old (non-buildkit, builders) |
| 4 | +ARG TARGETPLATFORM |
| 5 | +ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} |
| 6 | +RUN echo "Building for ${TARGETPLATFORM}" |
| 7 | + |
| 8 | +# Install some packages that are useful within the images. |
| 9 | +RUN apt-get update && apt-get install -y \ |
| 10 | + git \ |
| 11 | +&& rm -rf /var/lib/apt/lists/* |
| 12 | + |
| 13 | +# Install pickle as an easier alternative to PECL, that is not |
| 14 | +# available any more for PHP 8 and up. Some alternatives searched were: |
| 15 | +# - https://olvlvl.com/2019-06-docker-pecl-without-pecl |
| 16 | +# - https://github.com/FriendsOfPHP/pickle |
| 17 | +# - manually "curl https://pecl.php.net/get/xxxx && tar && docker-php-ext-install xxx" |
| 18 | +# Of course, if the images end using some alternative, we'll switch to it. Just right now |
| 19 | +# there isn't such an alternative.a |
| 20 | +# |
| 21 | +# Update 20201126: Finally, see https://github.com/docker-library/php/issues/1087 it seems that pear/pecl |
| 22 | +# continues being availbale with php8, so we are going to continue using it. The previous comments as |
| 23 | +# left in case we need to find an alternative way to install PECL stuff and there isn't any official. |
| 24 | +# For an example of php80-rc5 near complete, using pickle instead of pear/pecl, look to: |
| 25 | +# https://github.com/stronk7/moodle-php-apache/tree/8.0-buster-pickle-version |
| 26 | + |
| 27 | +# Setup the required extensions. |
| 28 | +ARG DEBIAN_FRONTEND=noninteractive |
| 29 | +ADD root/tmp/setup/php-extensions.sh /tmp/setup/php-extensions.sh |
| 30 | +RUN /tmp/setup/php-extensions.sh |
| 31 | + |
| 32 | +# Install Oracle Instantclient |
| 33 | +ADD root/tmp/setup/oci8-extension.sh /tmp/setup/oci8-extension.sh |
| 34 | +RUN /tmp/setup/oci8-extension.sh |
| 35 | +ENV LD_LIBRARY_PATH /usr/local/instantclient |
| 36 | + |
| 37 | +# Install Microsoft sqlsrv. |
| 38 | +ADD root/tmp/setup/sqlsrv-extension.sh /tmp/setup/sqlsrv-extension.sh |
| 39 | +RUN /tmp/setup/sqlsrv-extension.sh |
| 40 | + |
| 41 | +RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \ |
| 42 | + mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \ |
| 43 | + mkdir /var/www/behatdata && chown www-data /var/www/behatdata && \ |
| 44 | + mkdir /var/www/behatfaildumps && chown www-data /var/www/behatfaildumps |
| 45 | + |
| 46 | +ADD root/usr /usr |
| 47 | + |
| 48 | +# Fix the original permissions of /tmp, the PHP default upload tmp dir. |
| 49 | +RUN chmod 777 /tmp && chmod +t /tmp |
| 50 | + |
| 51 | +CMD ["apache2-foreground"] |
| 52 | +ENTRYPOINT ["moodle-docker-php-entrypoint"] |
0 commit comments