Skip to content

Instantly share code, notes, and snippets.

@zolthan
Last active September 30, 2020 07:39
Show Gist options
  • Save zolthan/9e95f974abb0888688b337887532881c to your computer and use it in GitHub Desktop.
Save zolthan/9e95f974abb0888688b337887532881c to your computer and use it in GitHub Desktop.
Pull Docker images for all projects
#!/bin/bash
# Add ssh agent
ssh-add
# Keep composer up to date
composer self-update
# The script assumes that you have all your projects collected in one directory like
# - ./Projects
# |- Project A
# |- Project B
# |- Project C
# This script has to be placed in the parent directory of all projects, in the example above ./Projects
# Cycle all directories
for d in */ ; do
pushd "$d"
# Check if there is a project git repo, then pull it
[ -d ".git" ] && git pull
# Check if we have a docker-compose definition, then pull it
[ -f "docker-compose.yml" ] && docker-compose pull
# Check if we have a composer definition, then install the deployment composer packages after the pull above
[ -f "composer.json" ] && composer install --ignore-platform-reqs --no-interaction --optimize-autoloader --no-suggest --no-scripts
# Check if we have a project in www directory, then install the project composer packages after the pull above
[ -d "www" ] && cd www && composer install --ignore-platform-reqs --no-interaction --optimize-autoloader --no-suggest --no-scripts
popd > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment