diff --git a/README.md b/README.md index 59a452a..35beb7f 100644 --- a/README.md +++ b/README.md @@ -120,5 +120,5 @@ To get the excact current version of a package, you can run `apk info php-8.2`. ## Examples - [Symfony Demo with FrankenPHP](examples/frankenphp-symfony-demo/README.md) +- [Symfony demo with FPM](examples/fpm-symfony-demo/README.md) - [Nginx + PHP-FPM](examples/nginx-php-fpm/README.md) -- [FPM standalone](examples/fpm/README.md) diff --git a/examples/fpm-symfony-demo/Dockerfile b/examples/fpm-symfony-demo/Dockerfile new file mode 100644 index 0000000..8c017b5 --- /dev/null +++ b/examples/fpm-symfony-demo/Dockerfile @@ -0,0 +1,52 @@ +# runtime dependencies +FROM ghcr.io/shyim/wolfi-php/fpm:8.2 as base +ENV APP_ENV=prod + +RUN apk add --no-cache \ + php-8.2-intl \ + php-8.2-simplexml \ + php-8.2-iconv \ + php-8.2-dom \ + php-8.2-xml \ + php-8.2-simplexml \ + php-8.2-pdo \ + php-8.2-pdo_sqlite + +# download symfony demo and build it +FROM base as composer + +RUN apk add --no-cache \ + git \ + composer \ + unzip \ + php-8.2 \ + php-8.2-curl \ + php-8.2-openssl \ + php-8.2-phar + +WORKDIR /app +RUN git clone https://github.com/symfony/demo.git --depth=1 . +RUN composer install +RUN bin/console asset-map:compile +RUN rm -rf .git + +# build fpm +FROM base as fpm + +COPY --link --from=composer --chown=82 /app /var/www/html + +# build nginx +FROM cgr.dev/chainguard/wolfi-base as nginx + +RUN < Nginx -> PHP-FPM +``` diff --git a/examples/fpm-symfony-demo/compose.yaml b/examples/fpm-symfony-demo/compose.yaml new file mode 100644 index 0000000..4988609 --- /dev/null +++ b/examples/fpm-symfony-demo/compose.yaml @@ -0,0 +1,11 @@ +services: + fpm: + build: + context: . + target: fpm + nginx: + build: + context: . + target: nginx + ports: + - "8000:8000" diff --git a/examples/fpm-symfony-demo/nginx.conf b/examples/fpm-symfony-demo/nginx.conf new file mode 100644 index 0000000..8c18a31 --- /dev/null +++ b/examples/fpm-symfony-demo/nginx.conf @@ -0,0 +1,44 @@ +worker_processes auto; +pid /tmp/nginx.pid; +daemon off; + +events { + worker_connections 1024; +} + +http { + + client_body_temp_path /tmp/client_body_temp; + proxy_temp_path /tmp/proxy_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + + server { + listen 8000; + server_name localhost; + + root /var/www/html/public; + index index.php; + include /etc/nginx/mime.types; + + location / { + try_files $uri /index.php$is_args$args; + } + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + include fastcgi.conf; + fastcgi_buffers 8 16k; + fastcgi_buffer_size 32k; + fastcgi_read_timeout 300s; + client_body_buffer_size 128k; + fastcgi_pass fpm:9000; + } + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + } +} diff --git a/examples/fpm/Dockerfile b/examples/fpm/Dockerfile deleted file mode 100644 index 8145ec8..0000000 --- a/examples/fpm/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ghcr.io/shyim/wolfi-php/base:latest - -RUN <