Production-ready Docker environment for Magento 2 with FrankenPHP — the modern, high-performance PHP application server
This repository is a GitHub template providing a ready-to-use Docker development and production environment for Magento 2 with FrankenPHP. Use it to bootstrap new Magento projects quickly with best practices for containerization.
- FrankenPHP — Modern PHP application server with Caddy
- Automatic HTTPS — Built-in SSL via Caddy
- Full Docker Stack — MariaDB, OpenSearch, Valkey, RabbitMQ, Mailhog
- High Performance — OPcache optimized, ~2500 req/s
- Dev Tools — Xdebug, CLI scripts, hot-reload ready
- Click "Use this template" on GitHub to create your own repository
- Clone your new repository:
git clone https://github.com/YOUR_USERNAME/your-magento-project.git
cd your-magento-project# 1. Clone
git clone https://github.com/CleatSquad/magento-frankenphp-template.git
cd magento-frankenphp-template
# 2. Setup environment (copies env templates automatically)
./bin/setup
# 3. Start containers
./bin/start
# 4. Access https://magento.localhostImportant: Place your Magento 2 source code in the
src/directory.
magento-frankenphp-template/
├── src/ # 👈 Your Magento 2 code goes here
├── bin/ # CLI tools
├── docker/ # Docker configurations
├── docs/ # Documentation
└── env/ # Environment templates
If you already have a Magento project, copy or clone it into the src/ directory:
# Copy existing project
cp -r /path/to/your/magento/* src/
# Or clone directly
git clone https://github.com/your-org/your-magento-repo.git src/For a fresh Magento installation:
# 1. Start the containers
./bin/start
# 2. Enter the container and create Magento project
./bin/bash
composer create-project --repository-url=https://repo.magento.com/ \
magento/project-community-edition .
exit
# 3. Run the interactive setup
./bin/setup-magentoThe setup-magento script will guide you through the installation process, asking for admin credentials, language, currency, and timezone settings.
make init # Initialize and start (first time)
make up # Start containers
make down # Stop containers
make help # Show all available commands- PHP 8.2, 8.3, 8.4 — All Magento-required extensions included
- Automatic HTTPS — Via Caddy web server
- OPcache optimized — Pre-configured for best performance
- Composer 2 — Latest version included
- Xdebug ready — Pre-configured in dev images
- Full stack included — MariaDB, OpenSearch, Valkey, RabbitMQ, Mailhog
- CLI tools — Convenient scripts in
bin/directory
| Guide | Description |
|---|---|
| Getting Started | Installation and initial setup |
| CLI Tools | All available commands |
| Configuration | Environment variables and settings |
| Caddyfile | Web server configuration |
| Xdebug | Debugging with Xdebug |
| Production | Production deployment |
| Local Dev | Development environment setup |
| Kubernetes | K8s deployment guide |
./bin/start # Start containers
make up # Start containers
./bin/stop # Stop containers
./bin/magento cache:flush
./bin/bash # Access app container shell
./bin/setup # Initial setup
./bin/composer install
./bin/mysql # Database CLI
make help # Show all Makefile targetsSee CLI Documentation for all commands.
- Docker >= 24.0
- Docker Compose >= 2.20
- Git
See CONTRIBUTING.md for guidelines and CODE_OF_CONDUCT.md for community standards.
See SECURITY.md for security policy and best practices.
MIT — see LICENSE