Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Docker Deployment Script with Error Handling, Detached Mode, and Rebuild Options #1320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AranavMahalpure
Copy link
Contributor

This pull request enhances the existing entrypoint.sh script by introducing the following improvements for a more robust and flexible Docker-based deployment process:

Error Handling:

Added error handling to ensure that if any docker compose command fails, the script exits with a clear error message. This prevents the script from continuing execution after encountering issues, ensuring a more reliable deployment.
Detached Mode (-d):

Enabled Docker Compose to run in detached mode (-d), ensuring the containers start in the background without blocking the terminal. This makes the process more efficient, especially for long-running services.
Rebuild on Start (--build):

Introduced the --build flag to force Docker Compose to rebuild the images before starting the containers. This ensures that any changes to the Dockerfile or source code are reflected in the running containers without needing manual intervention.
Graceful Shutdown (Optional):

Added a commented-out line for a graceful shutdown using docker compose down, allowing developers to easily stop and remove containers after they are no longer needed. This can be uncommented based on the desired behavior.

Details:
Azure-Specific vs. Default Configuration:

The script still checks for the presence of Azure-related environment variables (OPENAI_API_BASE, OPENAI_API_VERSION, AZURE_DEPLOYMENT_NAME, AZURE_EMBEDDINGS_DEPLOYMENT_NAME) to determine whether to use the Azure-specific Docker Compose file (docker-compose-azure.yaml) or the default configuration.
Error Handling:

The handle_error function was introduced to capture errors from Docker Compose commands and print a clear error message to standard error (stderr). If any command fails, the script immediately exits with a failure status (exit 1).
Docker Compose Improvements:

Detached Mode: Containers are now started in the background with docker compose up -d.
Rebuild on Start: The --build flag ensures that the Docker images are rebuilt before the containers are started, reflecting any changes to the source code.

Copy link

vercel bot commented Oct 14, 2024

@AranavMahalpure is attempting to deploy a commit to the Arc53 Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant