Comments (7)
Thanks for the sponsor :)
I just added the following to the base images (alpine and debian)
CONTAINER_POST_INIT_SCRIPT
= Put multiple scripts seperated by commas to execute before the overall container finalizes its init process.
CONTAINER_POST_INIT_COMMAND
= As Above but execute a singular command without having to insert a script somewhere. Seperate by commas.
NGINX_POST_INIT_SCRIPT
= Put multiple scripts seperated by commas to execute before the overall container finalizes its init process.
NGINX_POST_INIT_COMMAND
= As Above but execute a singular command without having to insert a script somewhere. Seperate by commas.
PHP_FPM_POST_INIT_SCRIPT
= Put multiple scripts seperated by commas to execute before the overall container finalizes its init process.
PHP_FPM_POST_INIT_COMMAND
= As Above but execute a singular command without having to insert a script somewhere. Seperate by commas.
So lots and lots of flexibility here on which way you want to use it. I included these multiples here just in the event that a child image clobbers some of the parent images custom environment variables if you are looking to use the image for complex stuff. I can already see this working in so many cases for my environments.
Should be available for you by tomorrow 8am PDT - Github build process is slower than I'd like and I have to remind myself to be around to trigger the next images builds after the first ones build and its now the end of my office day. Let me know how it works out.
FWIW - If you are doing some laravel work I have some real interesting stuff in some private images that you may want to take advantage of in terms of cache and config busting and also recompiling assets in a "development" style container. One simply needs to flip an environment variable from STAGE=develop
to STAGE=production
to make it exit it out of this development style mode. Let me know if of interest and I can clean it up for public consumption over the next few days.
from docker-nginx-php-fpm.
I think it should work with sail - Basically it is a series of extra scripts that run watchers when files are updated (css mostly) to recompile if you are doing things with Tailwind. Note, I know little to nothing of laravel other than maintain a few images and think its a pretty elegant framework, so I'll have to ask a couple people to find out more, but I'll definitely put this together and integrate it into the image in the near future - it may turn into it's own "laravel" image just to keep things clean but still relying on all the same functionality at this one. Lets see.
As for the amount of images, I question that myself. Things sort of grew with the first one tiredofit/wordpress
in 2017 and then grew from there. I started doing some consulting for an organization that was in desperate need for disaster recovery and couldn't didn't have any instructions on how to get their applications going again, so I started down that path.. Eventually I realized it would be good to build a few base images with common functions so that I could quickly roll out images. That's where we've ended up today and while there are the tricky parts to understand the applications in question the base images and the framework is what makes it easier for me. Of course it still is maintenance, but each and everyone is used in a production environment today, so that gives me motivation. It's probably not the best use of my time overall, but its what keeps my brain ticking as opposed to being lost in the business world 100%.
from docker-nginx-php-fpm.
I can insert what I do in some other images to accommodate for "custom scripts"
The premise would work like this:
- Drop file in
/assets/custom/01-artisan.sh
Inside that Script it could look like so:
#!/command/with-contenv /bin/bash
cd /www/${NGINX_WEBROOT}
sudo -u ${NGINX_USER} php artisan config:cache`
$(date) > /www/html/date.log
This would execute the script before nginx/php-fpm runs accomplishing what you are after.. I do have to watch out though as my dependent images also have this snippet for /assets/custom-scripts
and we wouldn't want to run it twice.
Perhaps I can include an environment variable that can call a specific script somewhere on the filesystem as such:
PHP_FPM_POST_SCRIPT="/somewhere/yourscript.sh
which would allow us to avoid the snippet in this image and let it work in the child images.
from docker-nginx-php-fpm.
Yes PHP_FPM_POST_SCRIPT would be brilliant! I'm sure people would use it since most articles i read recommend those types of scripts.
We'll try your first method out for now and look for any more official changes if they're ever pushed.
Thanks for everything @tiredofit !!!
from docker-nginx-php-fpm.
Wow you're awesome!
First off - yes i'll definitely look for the changes tomorrow!
Second - i think i'd definitely be interested IF it would work well with docker-compose and laravel sail, since that's what I've gotten used to.
BTW - How do you keep up with so many repos?
from docker-nginx-php-fpm.
... It's probably not the best use of my time overall, but its what keeps my brain ticking...
This could be said of huge parts of every moment of my life.
Also, and I'm just guessing here, but since laravel is super popular, and a lot of developers are just jumping into the docker ecosystem, you might find an audience there. I'd definitely recommend naming it laravel for search purposes if nothing else.
from docker-nginx-php-fpm.
I'm closing this since we are able to confirm that PHP_FPM_POST_INIT_SCRIPT is working great!
Thanks!
from docker-nginx-php-fpm.
Related Issues (20)
- `nginx` startup error HOT 5
- PHP_DISPLAY_ERRORS not work as expect HOT 4
- add a flag to disable php-fpm logs
- Server NGINX won't start up HOT 4
- opcache.max_accelerated_files=5413 HOT 3
- Nginx does not seem to be running - github codespace
- 02-pdo_pgsql.ini file not generated HOT 7
- Container cant start with nginx-php-fpm:8.2-alpine_edge-7.4.0 as base image HOT 2
- Want to modify php.ini HOT 2
- Add default index.php file for testing stock image HOT 1
- PHP_TIMEOUT doesn't update max_execution_time in php.ini HOT 5
- Install Openswoole HOT 2
- How to add scripts to crontab? HOT 3
- Trouble to use php-redis HOT 3
- Enable SMTP inside ENV variables, or docker-compose configuration?
- XDebug not available HOT 5
- PHP does not read environment variables HOT 2
- php-fpm doesn't start in PHP_FPM_CONTAINER_MODE=php-fpm HOT 5
- After update to 7.7.4 release getting `No such file or directory in log` HOT 2
- PHP 8.3 Debian image unavailable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-nginx-php-fpm.