I have a container that has a serivce app, that is built with a dockerfile.
services:
app:
build: docker
Inside my docker file i have at the end, a script.sh that i run to initialize drupal and databases
COPY script.sh /sh/script.sh
RUN chmod +x /sh/script.sh
CMD /sh/script.sh
WORKDIR /var/www
Inside my script.sh i have this
#!/usr/bin/env bash
php ./web/vendor/bin/drush cim -y &
wait
php ./web/vendor/bin/drush cr &
wait
exit 0
Everything works just fine the problem i have is that the service app stop right after it clear and rebuilt the cache. The problem is everytime I start the service app again it runs the dockerfile which run the script.sh to finally stop the service again So if anyone have a solution to this on why it does this and how to make so that the service doesn't stop when it finish the script.sh
Thanks for your helps
At the end of your entrypoint, put a command that will prevent the container from quitting, i.e.:
#!/usr/bin/env bash
set -e
php ./web/vendor/bin/drush cim -y
php ./web/vendor/bin/drush cr
tail -f -s5 /dev/null