Skip to content

Commit

Permalink
Dockerize using caddy and php-fpm
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-schindler committed May 12, 2023
1 parent 830c7e2 commit 8ff556d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:80 {
root * /srv
encode gzip zstd
php_fastcgi php-fpm:9000
file_server
# Force route through index.php
try_files {path} /index.php{path}
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ This router is dependency-free. The only composer packages installed are
[PHPStan](https://phpstan.org) and [PHPUnit](https://phpunit.de), for static
code analysis and unit testing. Remove with

```zsh
```bash
# Remove composer things
rm -rf vendor/ composer* .phpstan.neon .vscode/tasks.json
# Remove docker things
rm docker-compose.yml Caddyfile
```

and remove the autoloader from the `index.php` file.
Expand Down
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'

services:
caddy:
image: caddy:2-alpine
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./src:/srv

php-fpm:
image: php:8.2-fpm-alpine
volumes:
- ./src:/srv

0 comments on commit 8ff556d

Please sign in to comment.