full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

When does prestart.sh run and where is defined?

Open movaldivia opened this issue 4 years ago • 2 comments

When does prestart.sh run and where is defined? Any recommendation for development purposes on how to create the super-admin?

movaldivia avatar Sep 21 '21 15:09 movaldivia

I was also trying to understand this magically called prestart script, and after some digging, I found that it is defined in the base docker image tiangolo/uvicorn-gunicorn-fastapi:python3.7 used by the backend Dockerfile, base image defined at https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/

mandarup avatar Oct 07 '21 00:10 mandarup

Here's the origin in case anyone else is interested.

https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/49d3538121828a20f22b609c8278246e94a71d82/docker-images/start.sh#L23C1-L31C3

# ...
# If there's a prestart.sh script in the /app directory or other path specified, run it before starting
PRE_START_PATH=${PRE_START_PATH:-/app/prestart.sh}
echo "Checking for script in $PRE_START_PATH"
if [ -f $PRE_START_PATH ] ; then
    echo "Running script $PRE_START_PATH"
    . "$PRE_START_PATH"
else 
    echo "There is no script $PRE_START_PATH"
fi
# ...

Sweet script.

arthuralvim avatar Sep 09 '23 18:09 arthuralvim