2020-08-05 17:22:00 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# -e Exit immediately if a command exits with a non-zero status.
|
|
|
|
# -u Treat unset variables as an error when substituting.
|
|
|
|
set -eu
|
|
|
|
|
2020-10-19 11:49:00 +02:00
|
|
|
DOCKER_CONTEXT=vert
|
2020-08-05 17:22:00 +02:00
|
|
|
START=`date +%s`
|
|
|
|
|
|
|
|
help() {
|
|
|
|
echo
|
|
|
|
echo "💡 Aide 💡"
|
|
|
|
echo "----------"
|
|
|
|
echo
|
|
|
|
echo "Commandes :"
|
|
|
|
echo "- ./run dev 🚧 Lancement du serveur pour le développement"
|
|
|
|
echo "- ./run dev production 🚧 Lancement du serveur pour le développement sans les brouillons"
|
|
|
|
echo "- ./run prod 🚀 Déploiement du site en mode production"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
prod() {
|
|
|
|
echo
|
|
|
|
echo "🚀 Déploiement du site en mode production 🚀"
|
|
|
|
echo
|
|
|
|
rm -rf public
|
|
|
|
hugo --minify --environment production
|
|
|
|
# node themes/hugo-theme-lowtech/scripts/typo
|
|
|
|
#DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} +
|
|
|
|
docker-compose --context $DOCKER_CONTEXT -f docker-compose.prod.yml up -d --build --force-recreate
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# -ge 1 ]; then
|
|
|
|
if [ $1 == "dev" ]; then
|
|
|
|
if [ $# -ge 2 ] && [ $2 == "production" ]; then
|
|
|
|
echo "🚧 Lancement du serveur pour le développement sans les brouillons"
|
|
|
|
hugo server
|
|
|
|
else
|
|
|
|
echo "🚧 Lancement du serveur pour le développement"
|
|
|
|
hugo server -D
|
|
|
|
fi
|
|
|
|
elif [ $1 == "prod" ]; then
|
|
|
|
prod
|
|
|
|
else
|
|
|
|
help
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
help
|
|
|
|
fi
|
|
|
|
|
|
|
|
END=`date +%s`
|
|
|
|
echo
|
|
|
|
echo "✨ Done in $((END-START))s"
|
|
|
|
echo
|