Reputation: 2492
Currently I'm deploying my docker image into AppService for Linux from AzureDevops. I want to run some migrations before the container became fully available.
The db migrations are executed by calling a cli command in my container. How can I achieve this from DevOps pipeline?
Upvotes: 1
Views: 1313
Reputation: 72171
I suppose you have 2 options:
something like this:
RUN /bin/bash -c 'run migrations; run payload'
Upvotes: 1
Reputation: 21
We achieved this by modification of container entrypoint. We do not care much about the execution of migration from multiple containers simultaneously, it is handled by the migration framework.
#!/bin/bash
set -e
if [[ -n $MIGRATION_ONSTART ]]; then
( su -s /bin/bash -c "/var/www/bin/console migration:continue" www-data &)
fi
exec "$@"
Upvotes: 1