Created
November 4, 2024 11:31
-
-
Save tieutantan/6f71019a9958e36df4f990cfae3a7c25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Step 1: Delete Docker containers | |
docker rm -f store_api_php tools_api_php | |
# Function to switch branches, run docker-compose, and return to the last branch | |
run_docker_compose() { | |
local folder=$1 | |
local branch="installed-docker-xdebug" | |
# Navigate to the folder | |
cd "$folder" || exit | |
# Store the current branch | |
last_branch=$(git rev-parse --abbrev-ref HEAD) | |
# Checkout to branch-xdebug branch, run docker-compose, and switch back to the last branch | |
git stash | |
git checkout "$branch" | |
docker-compose up -d | |
git checkout "$last_branch" | |
# Return to the previous directory | |
cd - || exit | |
} | |
# Step 2: Process folder 1-store | |
run_docker_compose "1-store" | |
# Step 3: Process folder 1-tools | |
run_docker_compose "1-tools" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment