chore: backport fixes and improvements from API Platform

This commit is contained in:
Kévin Dunglas 2023-10-26 14:49:28 +02:00
parent ef8c7ad2a2
commit 6eee59b50d
9 changed files with 37 additions and 59 deletions

View File

@ -11,6 +11,10 @@
**/.gitattributes
**/.gitignore
**/.gitmodules
**/compose.*.yaml
**/compose.*.yml
**/compose.yaml
**/compose.yml
**/docker-compose.*.yaml
**/docker-compose.*.yml
**/docker-compose.yaml

View File

@ -16,57 +16,43 @@ trim_trailing_whitespace = true
insert_final_newline = true
[*.{js,html,ts,tsx}]
indent_style = space
indent_size = 2
[*.json]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.php]
indent_style = space
indent_size = 4
[*.sh]
indent_style = tab
indent_size = 4
[*.xml{,.dist}]
indent_style = space
indent_size = 4
[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
[.github/workflows/*.yml]
indent_style = space
indent_size = 2
[.gitmodules]
indent_style = tab
indent_size = 4
[.php_cs{,.dist}]
indent_style = space
indent_size = 4
[.travis.yml]
indent_style = space
indent_size = 2
[composer.json]
indent_style = space
indent_size = 4
[docker-compose{,.*}.{yaml,yml}]
[{,docker-}compose{,.*}.{yaml,yml}]
indent_style = space
indent_size = 2
[Dockerfile]
[{,*.*}Dockerfile]
indent_style = tab
[{,*.*}Caddyfile]
indent_style = tab
indent_size = 4

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
github: [dunglas]

View File

@ -18,19 +18,19 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
-
name: Build Docker images
uses: docker/bake-action@v3
uses: docker/bake-action@v4
with:
pull: true
load: true
files: |
docker-compose.yml
docker-compose.override.yml
compose.yaml
compose.override.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main
@ -66,7 +66,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0

View File

@ -47,7 +47,7 @@ ENV PATH="${PATH}:/root/.composer/vendor/bin"
COPY --from=composer_upstream --link /composer /usr/bin/composer
HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://localhost:2019/metrics || exit 1
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
# Dev FrankenPHP image

View File

@ -20,6 +20,7 @@ services:
extra_hosts:
# Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway
tty: true
###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###

View File

@ -4,13 +4,17 @@
frankenphp {
{$FRANKENPHP_CONFIG}
}
}
{$SERVER_NAME:localhost}
# https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
order mercure after encode
order vulcain after reverse_proxy
order php_server before file_server
}
{$CADDY_EXTRA_CONFIG}
log {
{$SERVER_NAME:localhost} {
log {
# Redact the authorization query parameter that can be set by Mercure
format filter {
wrap console
@ -20,10 +24,11 @@ log {
}
}
}
}
}
route {
root * /app/public
encode zstd gzip
mercure {
# Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
@ -38,28 +43,11 @@ route {
# Extra directives
{$MERCURE_EXTRA_DIRECTIVES}
}
vulcain
# Add trailing slash for directory requests
@canonicalPath {
file {path}/index.php
not path */
}
redir @canonicalPath {path}/ 308
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-topics=()"
# If the requested file does not exist, try index files
@indexFiles file {
try_files {path} {path}/index.php index.php
split_path .php
}
rewrite @indexFiles {http.matchers.file.relative}
# FrankenPHP!
@phpFiles path *.php
php @phpFiles
encode zstd gzip
file_server
respond 404
php_server
}