Last active
April 3, 2024 02:21
-
-
Save carloscarucce/c8b2380a1f347c2437e0303e939a9320 to your computer and use it in GitHub Desktop.
Determines whenever to run install, update or simply skip...
This file contains 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/sh | |
# @author: Carlos A. Bertholdo Carucce | |
# <https://github.com/carloscarucce> | |
if [[ ! -f "composer.json" ]]; then | |
echo "[Composer] composer.json was not found" >&2 | |
exit 1; | |
fi | |
if [[ -f "composer.lock" ]] && [[ -d "vendor" ]]; then | |
if [[ composer.json -nt composer.lock ]]; then | |
echo "[Composer] Updating dependencies: " | |
composer update --no-interaction | |
else | |
echo "[Composer] Nothing to install or update..." | |
fi | |
else | |
echo "[Composer] Installing dependencies: " | |
composer install --no-interaction | |
fi |
This file contains 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
# Example usage with Docker Compose | |
version: "1.0" | |
services: | |
composer: | |
image: composer:latest | |
volumes: | |
- ./:/app | |
working_dir: /app | |
command: ./composer-bootstrap.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment