Compare commits
3 Commits
efe59ee705
...
7264d1c1f8
Author | SHA1 | Date |
---|---|---|
|
7264d1c1f8 | 11 months ago |
|
1b56f805b2 | 11 months ago |
|
ab95e3d286 | 11 months ago |
@ -0,0 +1,36 @@
|
||||
**/*.log
|
||||
**/*.md
|
||||
**/*.php~
|
||||
**/*.dist.php
|
||||
**/*.dist
|
||||
**/*.cache
|
||||
**/._*
|
||||
**/.dockerignore
|
||||
**/.DS_Store
|
||||
**/.git/
|
||||
**/.gitattributes
|
||||
**/.gitignore
|
||||
**/.gitmodules
|
||||
**/compose.*.yaml
|
||||
**/compose.*.yml
|
||||
**/compose.yaml
|
||||
**/compose.yml
|
||||
**/docker-compose.*.yaml
|
||||
**/docker-compose.*.yml
|
||||
**/docker-compose.yaml
|
||||
**/docker-compose.yml
|
||||
**/Dockerfile
|
||||
**/Thumbs.db
|
||||
.drone.yml
|
||||
.github/
|
||||
.gitea/
|
||||
docs/
|
||||
public/bundles/
|
||||
tests/
|
||||
var/
|
||||
vendor/
|
||||
.editorconfig
|
||||
.env.*.local
|
||||
.env.local
|
||||
.env.local.php
|
||||
.env.test
|
@ -0,0 +1,32 @@
|
||||
FROM docker.io/dunglas/frankenphp:1-php8.3
|
||||
|
||||
RUN install-php-extensions \
|
||||
@composer \
|
||||
apcu \
|
||||
intl \
|
||||
opcache \
|
||||
zip \
|
||||
;
|
||||
|
||||
ENV APP_ENV=prod
|
||||
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
|
||||
ENV COMPOSER_ALLOW_SUPERUSER=1
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
COPY frankenphp/conf.d/app.ini frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
|
||||
COPY frankenphp/Caddyfile /etc/caddy/Caddyfile
|
||||
COPY frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
|
||||
COPY frankenphp/start.sh .
|
||||
|
||||
COPY composer.json composer.lock symfony.lock ./
|
||||
RUN composer install --no-cache --no-dev --no-autoloader --no-scripts --no-progress
|
||||
|
||||
COPY . .
|
||||
RUN composer dump-autoload --classmap-authoritative --no-dev \
|
||||
&& composer dump-env prod \
|
||||
&& composer run-script --no-dev post-install-cmd \
|
||||
;
|
||||
RUN rm -Rf frankenphp/
|
||||
|
||||
ENTRYPOINT [ "/app/start.sh" ]
|
@ -0,0 +1,55 @@
|
||||
{
|
||||
{$CADDY_GLOBAL_OPTIONS}
|
||||
|
||||
frankenphp {
|
||||
#worker /path/to/your/worker.php
|
||||
{$FRANKENPHP_CONFIG}
|
||||
}
|
||||
|
||||
# https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
|
||||
order mercure after encode
|
||||
order vulcain after reverse_proxy
|
||||
order php_server before file_server
|
||||
order php before file_server
|
||||
}
|
||||
|
||||
{$CADDY_EXTRA_CONFIG}
|
||||
|
||||
{$SERVER_NAME:localhost} {
|
||||
log {
|
||||
# # Redact the authorization query parameter that can be set by Mercure
|
||||
# format filter {
|
||||
# wrap console
|
||||
# fields {
|
||||
# uri query {
|
||||
# replace authorization REDACTED
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
output stdout
|
||||
}
|
||||
|
||||
root * public/
|
||||
encode zstd br gzip
|
||||
|
||||
# Uncomment the following lines to enable Mercure and Vulcain modules
|
||||
#mercure {
|
||||
# # Transport to use (default to Bolt)
|
||||
# transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
|
||||
# # Publisher JWT key
|
||||
# publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
|
||||
# # Subscriber JWT key
|
||||
# subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
|
||||
# # Allow anonymous subscribers (double-check that it's what you want)
|
||||
# anonymous
|
||||
# # Enable the subscription API (double-check that it's what you want)
|
||||
# subscriptions
|
||||
# # Extra directives
|
||||
# {$MERCURE_EXTRA_DIRECTIVES}
|
||||
#}
|
||||
#vulcain
|
||||
|
||||
{$CADDY_SERVER_EXTRA_DIRECTIVES}
|
||||
|
||||
php_server
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
expose_php = 0
|
||||
date.timezone = UTC
|
||||
apc.enable_cli = 1
|
||||
session.use_strict_mode = 1
|
||||
zend.detect_unicode = 0
|
||||
|
||||
; https://symfony.com/doc/current/performance.html
|
||||
realpath_cache_size = 4096K
|
||||
realpath_cache_ttl = 600
|
||||
opcache.interned_strings_buffer = 16
|
||||
opcache.max_accelerated_files = 20000
|
||||
opcache.memory_consumption = 256
|
||||
opcache.enable_file_override = 1
|
@ -0,0 +1,2 @@
|
||||
opcache.preload_user = root
|
||||
opcache.preload = /app/config/preload.php
|
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
exec frankenphp run --config /etc/caddy/Caddyfile
|
@ -0,0 +1,4 @@
|
||||
worker {
|
||||
file ./public/index.php
|
||||
env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Repository\PostRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class PostController extends AbstractController
|
||||
{
|
||||
#[Route('/', name: 'app_posts')]
|
||||
public function index(PostRepository $repository): Response
|
||||
{
|
||||
$posts = $repository->findAll();
|
||||
return $this->render('post/index.html.twig', [
|
||||
'posts' => $posts,
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Posts!{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% for post in posts %}
|
||||
<div class="card">
|
||||
#{{ post.id }} trouvé le {{ post.foundDate | date("d/m/Y \\à H \\h") }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Loading…
Reference in new issue