This base image contains some helper functionality to get a basic PHP project up and running. It utilizes Task and contains some basic tasks to perform common functionality.
The following PHP extensions are installed into this base image by default. You can view the modules by running docker run oberd/php-8.0-apache php -m
To include additional extensions, follow the steps from the official PHP base image documentation. Although, You should consider if the extension should be added to the base image or your project specific Dockerfile.
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
soap
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
The usage folder folder contains an example Dockerfile and Taskfile.yml that you can include in your project to get up and running.
If you're making a development stage of a multi-stage Dockerfile and want to enable Xdebug (should not be enabled in a production environment), you can add the following line to your development stage. It will install and enable the xdebug extension.
RUN enable-xdebug
The following tasks to be ran in a Taskfile are already pre-configured in /usr/local/tasks/
for usage in your projects. Check the sample Taskfile.yml for a standard usage in a Laravel environment.
This task will start Apache in the foreground
task -t tasks/apache.yml start
This task will cache your Laravel routes. Should only really be used in a production environment.
task -t tasks/laravel.yml cache
This task will run your Laravel migrations using the --force
flag.
task -t tasks/laravel.yml migrate
The Composer tasks should really only be ran in a development environment where the vendor directory may be volume mounted and cannot be included into the Docker image itself. A production image should contain the installed vendor directory within the image for consistency.
This task will configure composer with your Github OAuth token to allow access to private repositories and not be rate limited.
Requires: the environment variable GITHUB_OAUTH_TOKEN
to be set.
task -t tasks/composer.yml configure
This task is dependent upon the configure
task being ran. It will run composer install.
task -t tasks/composer.yml install
This task will configure the Xdebug remote host into the Xdebug config.
Optional: the environment variable XDEBUG_HOST_IP
can be set. Else, it will default to 10.254.254.254
Using the built in Apache commands a2ensite
and a2dissite
to enable and disable site configurations, this base image contains pre-defined configurations for some standard PHP frameworks.
To configure a standard Laravel project your code to /var/www/app
and this configuration will point the DocumentRoot to the public folder /var/www/app/public
RUN a2ensite laravel
COPY --chown=www-data:www-data . /var/www/app