dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.64k stars 218 forks source link

Custom Application Entrypoints #643

Closed sneycampos closed 5 months ago

sneycampos commented 6 months ago

Describe you feature request

Is your feature request related to a problem? Please describe. one of the steps that i use to run an laravel application is running php artisan optimize into the container There's any way to run "custom" entrypoint into the container?

Describe the solution you'd like I used to use webdevops php images to run php applications and one of his features is to run multiple scripts before the application is really up, for example: all scripts into /opt/docker/provision/entrypoint.d/ (webdevops documentation) will ran into the application context, like user.

Describe alternatives you've considered Meanwhile i'm using in Dockerfile something like:

run.sh

#!/bin/bash
php artisan optimize

Dockerfile

COPY --chmod=755 run.sh /usr/bin/run.sh
RUN /usr/bin/run.sh
withinboredom commented 6 months ago

Does https://github.com/dunglas/frankenphp/issues/490#issuecomment-1902702199 answer your question?

sneycampos commented 6 months ago

Does #490 (comment) answer your question?

Think so. I'm just trying to figure out how to build with these Caddy Modules and adding a custom Caddyfile to my application.

francislavoie commented 5 months ago

@sneycampos see https://frankenphp.dev/docs/docker/#how-to-install-more-caddy-modules which explains how to build with additional plugins

sneycampos commented 5 months ago

Thank you @francislavoie, forgot to close the issue. Before this i just want to say that in this documentation link, in the code says "# Mercure and Vulcain are included in the official build, but feel free to remove them" but if we remove from the build and don't remove from Caddyfile it will throw an error.

sneycampos commented 5 months ago

Closed the issue because it's not a issue per se, but i think is a nice to have in default build the option to set scripts, like .sh scripts, in a directory to be ran in the service initialization

macropin commented 3 months ago

There's any way to run "custom" entrypoint into the container?

I realise that I'm a bit late to the party, but this is a common requirement for container workloads. If you're looking for a generic solution, then may I suggest using the Heroku Procfile syntax to define custom entrypoints / commands. We put together bash functions which do the heavy lifting ref: https://github.com/panubo/bash-container