Created
January 15, 2023 11:35
-
-
Save oprietop/38708353bddd1a5b21767aac93e2f5b6 to your computer and use it in GitHub Desktop.
Create a docker-compose file extending all directories not beginning with _
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/sh | |
# Create a docker-compose file extending all directories not beginning with _ | |
FILE=docker-compose.yml | |
echo 'version: "3"' > ${FILE} | |
echo 'services:' >> ${FILE} | |
for ITEM in *; do | |
if [ -d "${ITEM}" ]; then | |
if [[ ${ITEM} == _* ]]; then | |
echo "Skipping ${ITEM}" | |
continue | |
fi | |
echo "Adding ${ITEM}" | |
cat <<EOF >> ${FILE} | |
${ITEM}: | |
extends: | |
file: ${ITEM}/docker-compose.yml | |
service: ${ITEM} | |
EOF | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment