Please submit a pull request or create an issue if you need another
module or package included or have other suggestions. The default
site was removed in order to load a custom vhost config, so when
extending this, use ADD
or COPY
to put a file into
/etc/apache2/sites-enabled
.
A full tutorial on using Docker is way beyond the scope of this quick guide, but I'm happy to incorporate suggestions on how to make this more thorough and easy for people to get started with.
- Install Docker
- Start the Docker host - on Linux just start the docker service. On Mac or Windows launch Docker Desktop, but be mindful that if creating a private repo, you will need a paid Docker Desktop license.
- Download this Docker image by running:
docker pull silintl/php8
- Now you'll need to incorporate your application. The easiest way to do that is to create a simple Dockerfile for your project that is based on this image. See below for an example.
- Build a Docker image for your application by running:
docker build -t="namespace/app-name"
- Finally, run your application as a Docker container by running:
docker run -d -P namespace/app-name
You can check if your container is running by running
docker ps
and see what port 80 got mapped to. Then you
should be able to access your application in your browser by
going to http://(DOCKER-IP-HERE):port
FROM silintl/php8
LABEL maintainer="Your Name <[email protected]>"
ENV REFRESHED_AT 2022-05-18
# Copy an Apache vhost file into sites-enabled. This should map
# the document root to whatever is right for your app
COPY vhost-config.conf /etc/apache2/sites-enabled/
RUN mkdir -p /data
VOLUME ["/data"]
# Copy your application source into the image
COPY application/ /data/
WORKDIR /data
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
<VirtualHost *:80>
ServerName myapp.local
DocumentRoot /data/frontend/web/
#RewriteEngine On
DirectoryIndex index.php
<Directory /data/frontend/web/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
LogLevel info
ErrorLog /var/log/apache2/myapp-error.log
CustomLog /var/log/apache2/myapp-access.log combined
</VirtualHost>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
The PHP version is tied to the Ubuntu version, which may delay and/or skip versions of PHP. The monthly build should pick up bug fixes, so no updates to this should be needed. For minor version upgrades, create a new branch, otherwise create a new repository.
- In the Dockerfile, update the following:
- Update ubuntu version in Dockerfile to newest version, creating that if necessary.
- Update
REFRESHED_AT
andMAINTAINER
, if needed - Update PHP version for config files at bottom of the file
- For new branch, do the following:
- Update default branch in Github to new branch