Last active
September 13, 2023 15:29
-
-
Save n1215/4569c9bb0b5cc68f91897028ffc8a0d3 to your computer and use it in GitHub Desktop.
build settings for Laravel + Heroku Buildpacks on AWS App Runner/Google Cloud Run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
env: | |
variables: | |
APPLICATION_NAME: "myapp" | |
PACK_VERSION: "0.29.0" | |
phases: | |
install: | |
commands: | |
- wget -q https://github.com/buildpacks/pack/releases/download/v$PACK_VERSION/pack-v$PACK_VERSION-linux.tgz -O - | tar -xz | |
- chmod +x ./pack | |
pre_build: | |
commands: | |
- AWS_ACCOUNT_ID=$CODEBUILD_BUILD_ARN && IFS=':' && set -- $AWS_ACCOUNT_ID && AWS_ACCOUNT_ID=$5 | |
- ECR_DOMAIN="$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com" | |
- ECR_REPOSITORY="$ECR_DOMAIN/$APPLICATION_NAME" | |
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_DOMAIN | |
build: | |
commands: | |
- | | |
./pack build "$ECR_REPOSITORY:latest" \ | |
--verbose \ | |
--no-color \ | |
--cache-image "$ECR_REPOSITORY:cache" \ | |
--tag "$ECR_REPOSITORY:$CODEBUILD_RESOLVED_SOURCE_VERSION" \ | |
--publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: gcr.io/k8s-skaffold/pack | |
args: | |
- build | |
- $_IMAGE_NAME:latest | |
- --verbose | |
- --tag | |
- $_IMAGE_NAME:$REVISION_ID | |
- --cache-image | |
- $_IMAGE_NAME:cache | |
- --publish | |
- name: gcr.io/cloud-builders/gcloud | |
args: | |
- run | |
- deploy | |
- $_APP_NAME | |
- --image | |
- $_IMAGE_NAME | |
- --region | |
- asia-northeast1 | |
- --allow-unauthenticated | |
substitutions: | |
_IMAGE_NAME: 'asia-northeast1-docker.pkg.dev/${PROJECT_ID}/myrepo/myapp' | |
_APP_NAME: 'myapp' | |
options: | |
logging: CLOUD_LOGGING_ONLY | |
dynamic_substitutions: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "laravel/laravel", | |
"type": "project", | |
"description": "The Laravel Framework.", | |
"keywords": ["framework", "laravel"], | |
"license": "MIT", | |
"require": { | |
- "php": "^8.1", | |
+ "php": "~8.2.0", | |
+ "ext-redis": "5.3.7", | |
"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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
try_files $uri @rewriteapp; | |
} | |
location @rewriteapp { | |
rewrite ^(.*)$ /index.php$1 last; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: heroku-php-nginx -C nginx.conf public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[_] | |
id = "my-project" | |
name = "My Project" | |
version = "1.0.0" | |
schema-version="0.2" | |
[io.buildpacks] | |
builder = "heroku/buildpacks:20" | |
exclude = [ | |
".idea", | |
"/README.md", | |
".git", | |
"/vendor", | |
"/node_modules", | |
"/bootstrap/cache/*.php", | |
] | |
[[io.buildpacks.group]] | |
uri = "heroku/php" | |
[[io.buildpacks.group]] | |
uri = "heroku/procfile" | |
[[io.buildpacks.group]] | |
uri = "heroku/nodejs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment