https://github.com/jonathandey/dcmp-server-stack
A Docker, Caddy (v1), Mariadb & PHP-FPM starting template for your PHP projects
https://github.com/jonathandey/dcmp-server-stack
caddy caddy-server docker laravel mariadb php-fpm php72
Last synced: 4 months ago
JSON representation
A Docker, Caddy (v1), Mariadb & PHP-FPM starting template for your PHP projects
- Host: GitHub
- URL: https://github.com/jonathandey/dcmp-server-stack
- Owner: jonathandey
- License: mit
- Created: 2019-11-24T11:15:24.000Z (over 6 years ago)
- Default Branch: php-7.2
- Last Pushed: 2019-11-24T12:11:16.000Z (over 6 years ago)
- Last Synced: 2025-09-16T03:50:52.191Z (9 months ago)
- Topics: caddy, caddy-server, docker, laravel, mariadb, php-fpm, php72
- Language: Dockerfile
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DCMP Stack
A Docker, Caddy (v1), Mariadb & PHP-FPM starting template for your PHP projects
## Getting started
1. `cp docker/db/.env.example docker/db/.env`
2. Optionally add an initial SQL file to the `docker/db/docker-entrypoint-initdb.d` directory
3. Run `docker-compose up app web db`
4. Visit 127.0.0.1:8080 in your web browser
## Configuring the Caddy server
All Caddy server configuration is in the file `docker/caddy/Caddyfile`
See the [Caddy V1 documentation](https://caddyserver.com/v1/docs) for further configuration options
## Configuring the database
The default database credentials are copied from the file `docker/db/.env.example` during the first step of Getting Started.
You can change the values to suit your project. More information about these values can be found at the [Mariadb docker hub page](https://hub.docker.com/_/mariadb)
```
MYSQL_DATABASE=app
MYSQL_USER=user
MYSQL_PASSWORD=password
MYSQL_RANDOM_ROOT_PASSWORD=true
```
## Running your code
This base template should get you running with most PHP applications. The PHP extensions: gd, iconv & pdo (mysql) are installed from the start, should you need to you can configure more extensions in the file `docker/php/Dockerfile`.
Now just add your code to the `src` folder.
## Running a Laravel app
Before Getting Started, run the command `docker-compose run composer composer create-project --prefer-dist laravel/laravel .` to install the latest version of Laravel.
Then update the file `docker/caddy/Caddyfile` to point the root to the public directory
```
0.0.0.0
root /var/www/html/public
fastcgi / app:9000 php {
root /var/www/html/public
}
rewrite {
regexp .*
ext /
to /index.php?{query}
}
gzip
tls off
```
Don't forget to update your applications `src/.env` file to match the database configuration values you set in `docker/db/.env`.