Skip to content

Commit ac2cfbf

Browse files
authored
Merge pull request #50 from fly-apps/upgrade_laravel_zero_move_chown_to_build_time
Update generated Dockerfile and entrypoint.sh to decrease deploy time: Main Change related to title: 1. Update Dockerfile and entrypoint.sh generated to move last chown into build time and not run time, this significantly slows down deploys - throttling is happening before supervisor even starts, due to chowning 6500+ files after running scripts in the entrypoint Other changes made: 1. Upgrade to Laravel Zero 11, for PHP8.4.1 - hHad to upgrade LZ to be able to build the changes 2. Update Dockerfile to use build script if vite.config.ts is detected - A project can come with vite.config.ts 3. Update Readme to mention upgrading the framework as a solution to failing builds, and using the options in handling new changes affecting test cases
2 parents 762b43f + d5895d8 commit ac2cfbf

14 files changed

Lines changed: 1710 additions & 993 deletions

File tree

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Before diving into making local development changes, there're some to-do's to ge
9494

9595
1. Clone the repository
9696
2. Get the repo dependencies with `composer install`
97-
3. And, just in case you ever find an error about files not being available, you might be able to fix this with providing the proper permission to the box package used by Laravel Zero framework: `chmod 755 vendor/laravel-zero/framework/bin/box`.
97+
3. If you run into any issues, find the `Getting Past Hurdles` section below for common solutions
9898

9999
Then, yes. After set up, you can make your changes!
100100

@@ -111,6 +111,16 @@ Simply run the build command:
111111
```
112112
php dockerfile-laravel app:build
113113
```
114+
115+
### Getting Pass Hurdles
116+
Below are some common problems with local set up and building
117+
118+
#### Files Not available
119+
If you ever find an error about files not being available, you might be able to fix this with providing the proper permission to the box package used by Laravel Zero framework: `chmod 755 vendor/laravel-zero/framework/bin/box`.
120+
121+
#### Build Compile Error
122+
If your build runs into a compile error, try upgrading to the next Laravel Zero Version, see [upgrade guide](https://laravel-zero.com/docs/upgrade#upgrade-11.0.0).
123+
114124
#### Build View Changes
115125
If changes were made in any of the view files, make sure to clear the cached views( For now, this can be done by manually deleting the cached files ). The path to where the views' caches are stored is configured in `config/view.php`.
116126

@@ -125,6 +135,12 @@ Once you've successfully built your changes, you have to test how it turned out.
125135
```
126136
And that's it! You should now see a fresh Dockerfile available for your project.
127137

138+
### Testing the Dockerfile generated Locally
139+
1. Make sure that the necessary files that are needed locally is available to the image by reviewing the .dockerignore and .gitignore
140+
2. Build the image with `docker build -t <image-name> .`
141+
3. Run the image with `docker run -it -p 8080:8080 <image-name>`
142+
143+
128144
## Test Cases
129145
There are two general purpose test cases in `tests/Feature/GenerateCommandTest.php`:
130146

@@ -143,6 +159,10 @@ There are two general purpose test cases in `tests/Feature/GenerateCommandTest.p
143159

144160
These test cases are used to make sure new changes would not break existing features of the `generate` command. These can be run through `./vendor/bin/pest`.
145161

162+
## Note on Testcases
163+
If new template changes are made, then it would follow that the generated test template files that are used to test the generated files would not match with the generated files. It goes to say, there are two options in resolving this:
164+
- Manually update each template file to apply the new changes
165+
- OR automatically override the test templates with the new files generated by setting the .env variable `OVERRIDE_TEST_REFERENCES=true`
146166

147167
## Contribution
148168
Once you've cooked up and tested your local changes, you can make a Pull Request to request its inclusion in this repository. ( BONUS points if you add a test case for your change! )

builds/dockerfile-laravel

3.88 MB
Binary file not shown.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"laravel/pint": "^1.13",
2525
"mockery/mockery": "^1.6",
2626
"pestphp/pest": "^2.22",
27-
"illuminate/view": "^10.0",
28-
"laravel-zero/framework": "^10.2",
27+
"illuminate/view": "^11.0",
28+
"laravel-zero/framework": "^11.0",
2929
"phpspec/php-diff": "^1.1",
30-
"nunomaduro/termwind": "^1.15.1"
30+
"nunomaduro/termwind": "^2.0"
3131
},
3232
"autoload": {
3333
"psr-4": {

0 commit comments

Comments
 (0)