2020-10-06 12:29:22 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
yq() {
|
2022-06-27 16:05:28 +02:00
|
|
|
docker run --rm -i -v "${PWD}:/workdir" --user "$UID" mikefarah/yq:4 "$@"
|
2020-10-06 12:29:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
config()
|
|
|
|
{
|
|
|
|
echo -ne "Checking user... "
|
|
|
|
if [[ "$(whoami)" != "root" ]] && ! groups | grep docker
|
|
|
|
then
|
|
|
|
echo "Please add your current user to the docker group OR run this script as root."
|
|
|
|
echo "current user is not allowed to use docker, exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-03-01 12:18:20 +01:00
|
|
|
SERVICE="$(yq eval '.services.*.image | select(. == "sleede/fab-manager*") | path | .[-2]' docker-compose.yml)"
|
2021-05-18 09:40:35 +02:00
|
|
|
echo -e "\n"
|
2020-10-06 12:29:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
change_mount()
|
|
|
|
{
|
2021-03-08 12:08:17 +01:00
|
|
|
if [[ $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*assets\")" docker-compose.yml) ]]; then
|
2022-06-08 10:21:16 +02:00
|
|
|
yq -i eval ".services.$SERVICE.volumes.[] |= select(. == \"*assets\") |= \"\./public/packs:/usr/src/app/public/packs\"" docker-compose.yml
|
2021-03-08 12:08:17 +01:00
|
|
|
echo "Service volume was replaced for $SERVICE: /assets changed to /packs"
|
|
|
|
fi
|
2020-10-06 12:29:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
proceed()
|
|
|
|
{
|
|
|
|
config
|
|
|
|
change_mount
|
|
|
|
}
|
|
|
|
|
|
|
|
proceed "$@"
|