No one likes to see their website broken during the deployment since it scares off the potential customers and causes them to bounce. Not exactly the prospective successful Magento 2 store owners look for.
Fortunately, there is the Magento 2 Zero Downtime Deployment extension that fixes this and reduces the downtime to zero. It allows you to run the deployment commands with no website breakage. Speaking of which, here is the list of the deployment commands you have to run to reduce the downtime to ZERO.
In order to redeploy Magento completely, you have to run
If you only want to deploy dependency injection (bin/magento setup:di:compile), then use
bin/magento magefan:zero-downtime:deploy - d
To run the Magento static content (bin/magento setup:static-content:deploy) use
bin/magento magefan:zero-downtime:deploy - s
In case you want to run multiple parameters script, use the following command
bin/magento magefan:zero-downtime:deploy -d -s
For the updating Magento 2 database data and schema (bin/magento setup:upgrade) use
bin/magento setup:upgrade --keep-generated
Note: you can use only these commands to reduce the deployment time to ZERO once you configure the Magento 2 Zero Downtime Deployment extension.