Skip to content

99linesofcode/docker-php

docker-php

Docker PHP is a collection of services and containers intended to be pulled into a project as a submodule or subtree. It contains all the services necessary to serve a modern Laravel app for development purposes. It's similar to what Laravel Sail provides but is further configured to suit my personal needs and preferences.

Additionally, this repository contains a production ready FrankenPHP container that's pre-configured to automatically request SSL certificates using a Cloudflare DNS challenge when built for production. See the frankenphp/ subdirectory.

How to use

  1. Change to your project root directory (for example: cd ./laravel-starter);
  2. git submodule add https://github.com/99linesofcode/docker-php.git docker;
  3. cp docker/docker-compose.yaml.dist ./docker-compose.yaml;
  4. Configure the environment variables defined in docker/.env.example file in your ./.env;
  5. Run docker compose up -d to spin up your development environment.

Almost all the relevant configuration is done in/from the docker-compose.yaml file. Optional services are disabled by default. You can enable these by uncommenting their respective service blocks.

Production

There are several ways to run Docker PHP in production. Using docker compose -d similarly to how you run it in development or by manually building and packaging the app up into a docker image and pushing it to and pulling it from a container registry.

The FrankenPHP container uses the multi-stage build process and can be further optimized for production. If you intend to use docker compose in production you will have to change the services.frankenphp.build.target to production.

If you choose to package your app and serve it differently, make sure to pass the --target production flag to your docker build command like so: docker build --target production -t frankenphp:production -f ./frankenphp/Dockerfile ..

Contributing

Please review the Contribution Guidelines.

Code of conduct

In order to ensure that the community is welcoming to all, please review and abide by the Code of Conduct.

Security vulnerabilities

Please review the security policy on how to report security vulnerabilities.

License

This software is open source and licensed under the MIT license.

About

Docker containers for PHP development and deployment

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors