Compare commits

...

3 Commits

Author SHA1 Message Date
168bf04550 chore: speeds up startup healthchecks 2025-05-23 15:40:56 -05:00
81eb2d1f62 chore: small code cleanup 2025-05-23 14:56:24 -05:00
f5102b859f fix: adds php opcache 2025-05-23 14:56:06 -05:00
7 changed files with 17 additions and 20 deletions

View File

@@ -1,19 +1,20 @@
FROM php:8.4-fpm-alpine3.21 FROM trafex/php-nginx:3.9.0
RUN docker-php-ext-install pdo_mysql USER root
# SETUP PHP-FPM CONFIG SETTINGS (max_children / max_requests) RUN apk add --no-cache \
RUN echo 'pm = dynamic' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \ php84-opcache \
echo 'pm.max_children = 75' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \ php84-pdo_mysql \
echo 'pm.start_servers = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \ php84-simplexml
echo 'pm.min_spare_servers = 5' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
echo 'pm.max_spare_servers = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \ USER nobody
echo 'pm.process_idle_timeout = 10s' >> /usr/local/etc/php-fpm.d/zz-docker.conf
COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/ COPY --chmod=0775 ./bash/entrypoint.sh /usr/local/bin/
COPY --chmod=0755 ./bash/nginx.conf /etc/nginx/conf.d/site.conf
HEALTHCHECK --interval=5s --timeout=5s --retries=5 CMD [ "php", "/var/www/bin/console", "startup:status" ] HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/var/www/bin/console", "startup:status" ]
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
WORKDIR /var/www WORKDIR /var/www

View File

@@ -1,9 +1,8 @@
#!/bin/sh #!/bin/sh
# Sleep for a second to ensure DB is awake and ready # Sleep for a second to ensure DB is awake and ready
SLEEP_TIME=$(shuf -i 2-5 -n 1) SLEEP_TIME=$(shuf -i 2-4 -n 1)
echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database" echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database"
echo "> If there are errors after the migration runs, it's possible another container (scheduler, worker, etc.) already ran the migrations"
sleep $SLEEP_TIME sleep $SLEEP_TIME
# Provision database # Provision database

View File

@@ -21,7 +21,7 @@ services:
app: app:
build: build:
dockerfile: docker/Dockerfile.app dockerfile: Dockerfile
context: . context: .
ports: ports:
- "8001:80" - "8001:80"
@@ -89,7 +89,8 @@ services:
MYSQL_ROOT_PASSWORD: password MYSQL_ROOT_PASSWORD: password
healthcheck: healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 10s interval: 5s
timeout: 5s
retries: 10 retries: 10
adminer: adminer:

View File

@@ -3,6 +3,7 @@ FROM trafex/php-nginx:3.9.0
USER root USER root
RUN apk add --no-cache \ RUN apk add --no-cache \
php84-opcache \
php84-pdo_mysql \ php84-pdo_mysql \
php84-simplexml php84-simplexml

View File

@@ -1,3 +0,0 @@
FROM nginx:1.28-alpine
COPY bash/nginx.conf /etc/nginx/conf.d/default.conf

View File

@@ -2,10 +2,8 @@
namespace App\User\Framework\Controller\Web; namespace App\User\Framework\Controller\Web;
use App\User\Action\Handler\RegisterUserHandler;
use App\User\Framework\Repository\UserRepository; use App\User\Framework\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;