Closed PS-StuartZahn closed 4 years ago
You could simply use the old tail -f /dev/null
to keep it alive. I would recommend you execute the commands to start the database and update it in reverse order. There is a built in sleep in the provided command to wait for the server to be ready anyways.
I thought about this a bit. I agree you could add another & or && and keep it alive without node running, but that would make for a non-purposeful container. The point of this particular example is to provide a node app with a SQL database backing it. If node dies then it won't fulfill the containers purpose and it is better that it dies completely. A better design of course is to implement SQL in one contianer and the node app in another container. That was raised in a different issue #10 and I've provided some links to examples where I do separate them.
How would you keep the container alive without running a node web service as the last command while still starting sql server and initializing the database after the server has started? Wouldn't it be better to register sql server as a service, and then import the data and have the final command check for the service?
Something like this:
/opt/mssql/bin/sqlservr & ./init_db.sh && while true; do sleep 1; done