1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

webpack deployment script

This commit is contained in:
Sylvain 2020-10-06 12:29:22 +02:00
parent 8af0450bca
commit 892d010cd4
2 changed files with 46 additions and 0 deletions

View File

@ -9,6 +9,7 @@
- Updated angular-bootstrap-switch to 0.5.2
- Updated bootstrap-switch to 3.4.0
- Updated fullCalendar to 3.10.2
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/mount-webpack.sh | bash`
## v4.5.9 2020 September 29

45
scripts/mount-webpack.sh Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
yq() {
docker run --rm -i -v "${PWD}:/workdir" mikefarah/yq yq "$@"
}
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
if ! command -v awk || ! [[ $(awk -W version) =~ ^GNU ]]
then
echo "Please install GNU Awk before running this script."
echo "gawk was not found, exiting..."
exit 1
fi
SERVICE="$(yq r docker-compose.yml --printMode p 'services.*(.==sleede/fab-manager*)' | awk 'BEGIN { FS = "." } ; {print $2}')"
}
change_mount()
{
local volumes=$(yq r docker-compose.yml --length "services.$SERVICE.volumes")
local maxVol=$(($volumes - 1))
for i in $(seq 0 $maxVol); do
yq r docker-compose.yml "services.$SERVICE.volumes.[$i]" | grep assets
if [[ $? = 0 ]]; then
yq w docker-compose.yml "services.$SERVICE.volumes.[$i]" "\${PWD}/public/packs:/usr/src/app/public/packs"
echo "Volume #$i was replaced for $SERVICE: /assets changed to /packs"
exit 0
fi
done
}
proceed()
{
config
change_mount
}
proceed "$@"