diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bd35b59 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.php] +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..6ad60bd --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: heroku-php-nginx -i ${PHP_INI-config/php.ini} -C ${NGINX_CONF-config/nginx.conf} ${WEBROOT-web} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..990e413 --- /dev/null +++ b/composer.json @@ -0,0 +1,29 @@ +{ + "name": "felegy/test", + "type": "project", + "require": { + "php": ">=7.4 <8.4", + "ext-gd": "*", + "ext-redis": "*", + "ext-mbstring": "*", + "ext-soap": "*", + "ext-exif": "*", + "ext-imagick": "*", + "ext-intl": "*" + }, + "require-dev": { + "heroku/heroku-buildpack-php": "*" + }, + "license": "MIT", + "autoload": { + "psr-4": { + "Felegy\\Test\\": "web/" + } + }, + "authors": [ + { + "name": "felegy", + "email": "felegy@hvg.hu" + } + ] +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..08d9779 --- /dev/null +++ b/composer.lock @@ -0,0 +1,73 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "dc6d465ed02db34e2d110dfb57b6f81f", + "packages": [], + "packages-dev": [ + { + "name": "heroku/heroku-buildpack-php", + "version": "v271", + "source": { + "type": "git", + "url": "https://github.com/heroku/heroku-buildpack-php.git", + "reference": "ef47055d9630c842536b876b04325c337b51fd2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/ef47055d9630c842536b876b04325c337b51fd2c", + "reference": "ef47055d9630c842536b876b04325c337b51fd2c", + "shasum": "" + }, + "bin": [ + "bin/heroku-php-apache2", + "bin/heroku-php-nginx" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Zuelke", + "email": "dz@heroku.com" + } + ], + "description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP and Apache2/Nginx as on Heroku", + "homepage": "https://github.com/heroku/heroku-buildpack-php", + "keywords": [ + "apache", + "apache2", + "foreman", + "heroku", + "nginx", + "php" + ], + "support": { + "issues": "https://github.com/heroku/heroku-buildpack-php/issues", + "source": "https://github.com/heroku/heroku-buildpack-php/tree/v271" + }, + "time": "2025-07-31T20:24:02+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.4 <8.4", + "ext-gd": "*", + "ext-redis": "*", + "ext-mbstring": "*", + "ext-soap": "*", + "ext-exif": "*", + "ext-imagick": "*", + "ext-intl": "*" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000..2d38525 --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,47 @@ +server_tokens off; + +add_header X-Frame-Options SAMEORIGIN; +add_header X-Content-Type-Options nosniff; +add_header X-XSS-Protection "1; mode=block"; +add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; +add_header Referrer-Policy "same-origin"; +add_header Feature-Policy "geolocation none;"; +add_header Content-Security-Policy upgrade-insecure-requests; + +index index.php index.html; +charset UTF-8; +default_type text/html; + +gzip on; +gzip_disable "msie6"; + +gzip_vary on; +gzip_proxied any; +gzip_comp_level 6; +gzip_buffers 16 8k; +gzip_min_length 10; +gzip_http_version 1.1; +gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg; + +client_max_body_size 64M; + +# Force HTTPS on Heroku +if ($http_x_forwarded_proto = "http") { + return 301 https://$host$request_uri; +} + +location / { + # try to serve file directly, fallback to rewrite + try_files $uri @rewriteapp; +} + +location @rewriteapp { + # rewrite all to app.php + rewrite ^(.*)$ /app.php/$1 last; +} + +location ~ ^/(app|app_dev|config)\.php(/|$) { + try_files @heroku-fcgi @heroku-fcgi; + # ensure that /app.php isn't accessible directly, but only through a rewrite + internal; +} diff --git a/config/php.ini b/config/php.ini new file mode 100644 index 0000000..e69de29 diff --git a/project.toml b/project.toml new file mode 100644 index 0000000..493feca --- /dev/null +++ b/project.toml @@ -0,0 +1,17 @@ +[_] +schema-version = "0.2" + +[_.metadata] +org.opencontainers.image.source = "https://git.saito.systems/felegy/test" +org.opencontainers.image.description= "Test PHP cnb image" + +[io.buildpacks] +builder = "heroku/builder:24" +include = [ + ".profile.d", + "Procfile", + "config", + "web", + "composer.json", + "composer.lock" +] diff --git a/web/app.php b/web/app.php new file mode 100644 index 0000000..1eb0fde --- /dev/null +++ b/web/app.php @@ -0,0 +1,5 @@ +Welcome kpack CNB PHP test image"; + +require_once dirname(__FILE__).'/app/info.php'; diff --git a/web/app/info.php b/web/app/info.php new file mode 100644 index 0000000..723c8e3 --- /dev/null +++ b/web/app/info.php @@ -0,0 +1,8 @@ +