full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
When does prestart.sh run and where is defined?
When does prestart.sh run and where is defined? Any recommendation for development purposes on how to create the super-admin?
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/
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.