A small, easily deployable template to make a self contained PHP app in a container.
  • Dockerfile 56.2%
  • Makefile 26.8%
  • PHP 17%
Find a file
2026-11-26 11:25:33 +01:00
app Wrote basic documentation on the template 2026-11-26 11:25:33 +01:00
Dockerfile Basic skeleton with customizable php extensions 2026-11-26 11:12:23 +01:00
env.list Basic skeleton with customizable php extensions 2026-11-26 11:12:23 +01:00
Makefile Basic skeleton with customizable php extensions 2026-11-26 11:12:23 +01:00
README.md Wrote basic documentation on the template 2026-11-26 11:25:33 +01:00

PHP Docker Template

Description

This repo contains a template for building a PHP application that will run inside a docker container.

Usage

PHP code shoud be placed in the app/ directory. Once the image is built, this directory will be copied and renamed to /var/www/html inside the container. The apache server in the container will point to and serve this directory.

Some aspects of the build process, such as adding PHP extensions, can be changed by editing the env.list file.

All variables declared in the env.list file will also be available as environment variables in the container. Useful for passing database information and such.

Deployment

A Makefile is included to facilitate building and running the container. make build will build the image but will not run it. make run-test will build the image and launch it, attaching it to the current terminal.

The container will automatically remove itself once stopped, which can be done by entering Ctrl+C in the terminal that the container has attached to.

Access

The container binds to port 80 of the local host. Accessing the application therefor becomes as simple as opening http://localhost:80 in the URL bar of a web browser while the container is running.