Skip to content

Instantly share code, notes, and snippets.

@n1215
Last active June 15, 2023 03:50
Show Gist options
  • Save n1215/6e942cff4c08a935daf4e2fcc33a4a23 to your computer and use it in GitHub Desktop.
Save n1215/6e942cff4c08a935daf4e2fcc33a4a23 to your computer and use it in GitHub Desktop.
build a Laravel app container image using Google Cloud's Buildpacks
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
- "php": "^8.1",
+ "php": "~8.2.0",
+ "ext-grpc": "*",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
fastcgi_read_timeout 24h;
# proxy_* are not set for PHP because fastcgi is used.
upstream fast_cgi_app {
server unix:/layers/google.php.webconfig/webconfig/app.sock fail_timeout=0;
}
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name "";
root /workspace/public;
rewrite ^/(.*)$ /index.php$uri;
location ~ ^/index.php {
error_log stderr;
fastcgi_pass fast_cgi_app;
fastcgi_buffering off;
fastcgi_request_buffering off;
fastcgi_cache off;
fastcgi_store off;
fastcgi_intercept_errors off;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
if ($http_x_forwarded_proto = 'https') {
set $https_setting 'on';
}
fastcgi_param HTTPS $https_setting if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param REMOTE_HOST $remote_addr;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param X_FORWARDED_FOR $proxy_add_x_forwarded_for;
fastcgi_param X_FORWARDED_HOST $http_x_forwarded_host;
fastcgi_param X_FORWARDED_PROTO $http_x_forwarded_proto;
fastcgi_param FORWARDED $http_forwarded;
}
}
{
"private": true,
+ "engines": {
+ "node": "18.x"
+ },
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"vite": "^4.0.0"
}
}
[opcache]
zend_extension=opcache
opcache.enable=1
[grpc]
extension=grpc.so
; PHP extension files in gcr.io/buildpacks/builder:v1
; grpc.so
; imagick.so
; mailparse.so
; memcached.so
; mongodb.so
; opcache.so
; opencensus.so
; protobuf.so
; redis.so
web: pid1 --nginxBinaryPath nginx --nginxConfigPath /layers/google.php.webconfig/webconfig/nginx.conf --serverConfigPath /workspace/nginxserver.conf --nginxErrLogFilePath /layers/google.php.webconfig/webconfig/nginx.log --customAppCmd "php-fpm -R --nodaemonize --fpm-config /layers/google.php.webconfig/webconfig/php-fpm.conf" --pid1LogFilePath /layers/google.php.webconfig/webconfig/pid1.log --mimeTypesPath /layers/google.utils.nginx/nginx/conf/mime.types --customAppSocket /layers/google.php.webconfig/webconfig/app.sock
[_]
id = "my-project"
name = "My Project"
version = "1.0.0"
schema-version="0.2"
[io.buildpacks]
builder = "gcr.io/buildpacks/builder:v1"
exclude = [
".idea",
"/README.md",
".git",
"/vendor",
"/node_modules",
"/bootstrap/cache/*.php",
]
[[io.buildpacks.group]]
uri = "google.nodejs.runtime"
[[io.buildpacks.group]]
uri = "google.nodejs.npm"
[[io.buildpacks.group]]
uri = "google.php.runtime"
[[io.buildpacks.group]]
uri = "google.php.composer-install"
[[io.buildpacks.group]]
uri = "google.php.composer"
[[io.buildpacks.group]]
uri = "google.php.webconfig"
[[io.buildpacks.group]]
uri = "google.utils.nginx"
[[io.buildpacks.group]]
uri = "google.config.entrypoint"
[[io.buildpacks.group]]
uri = "google.utils.label-image"
[[io.buildpacks.build.env]]
name = "GOOGLE_COMPOSER_VERSION"
value = "2.5.8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment