diff --git a/Dockerfile.nginx b/Dockerfile.nginx new file mode 100644 index 0000000..ec9d167 --- /dev/null +++ b/Dockerfile.nginx @@ -0,0 +1,2 @@ +FROM nginx:latest +COPY default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/Dockerfile.php b/Dockerfile.php new file mode 100644 index 0000000..58918bb --- /dev/null +++ b/Dockerfile.php @@ -0,0 +1,12 @@ +FROM php:8.2-fpm +#WORKDIR /var/www/html +COPY ./ /var/www/html/ + +RUN apt-get update \ + && apt-get install -y git libzip-dev zip \ + && docker-php-ext-install zip \ + && cd /var/www/html \ + && chmod +x composer_install.sh && ./composer_install.sh \ + && mv composer.phar /usr/local/bin/composer \ + && composer install \ + && rm compose.yml composer_install.sh default.conf Dockerfile.nginx Dockerfile.php diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..3d3e4ea --- /dev/null +++ b/compose.yml @@ -0,0 +1,22 @@ +#php:8-fpm-alpine +#nginx:latest-alpine //v1.25 + +services: + nginx: + build: + dockerfile: Dockerfile.nginx + ports: + - "8000:80" + volumes: + - myVolume:/var/www/html + links: + - php-fpm + + php-fpm: + build: + dockerfile: Dockerfile.php + volumes: + - myVolume:/var/www/html + +volumes: + myVolume: \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..61c8173 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "jumbojett/openid-connect-php": "^0.9.10" + } +} \ No newline at end of file diff --git a/composer_install.sh b/composer_install.sh new file mode 100644 index 0000000..585031d --- /dev/null +++ b/composer_install.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + +if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] +then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 +fi + +php composer-setup.php --quiet +RESULT=$? +rm composer-setup.php +exit $RESULT \ No newline at end of file diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..dc267af --- /dev/null +++ b/default.conf @@ -0,0 +1,24 @@ +server { + index index.php index.html; + server_name phpfpm.local; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + root /var/www/html; + + location ~/.(env*)$ { + return 404; + } + + location ~ \.php$ { + index index.php; + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php-fpm:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + + +} \ No newline at end of file