Use VITE-variables on build [skip-ci]

This commit is contained in:
Christian Cueni 2022-11-09 10:57:40 +01:00
parent 66ea5f3154
commit d1de8d4ace
1 changed files with 15 additions and 0 deletions

View File

@ -6,16 +6,31 @@ LATEST="${REPO}:latest"
BUILD_TIMESTAMP=$( date '+%F_%H:%M:%S' ) BUILD_TIMESTAMP=$( date '+%F_%H:%M:%S' )
VERSION_TAG="${REPO}:$VERSION" VERSION_TAG="${REPO}:$VERSION"
LOCAL_LOGOUT=$VITE_LOGOUT_REDIRECT
APP_NAME=${1:-vbv-lernwelt} APP_NAME=${1:-vbv-lernwelt}
echo "Deploy to $APP_NAME" echo "Deploy to $APP_NAME"
if [[ "$APP_NAME" == "myvbv" ]]
then
VITE_LOGOUT_REDIRECT="https://edumgr.b2clogin.com/edumgr.onmicrosoft.com/b2c_1_signupandsignin/oauth2/v2.0/logout/?post_logout_redirect_uri=https://myvbv.iterativ.ch/"
elif [[ "$APP_NAME" == "myvbv-stage" ]]
then
VITE_LOGOUT_REDIRECT="https://vbvtst.b2clogin.com/vbvtst.onmicrosoft.com/b2c_1_signupandsignin/oauth2/v2.0/logout/?post_logout_redirect_uri=https://myvbv-stage.iterativ.ch/"
elif [[ "$APP_NAME" == "vbv-lernwelt" ]]
then
VITE_LOGOUT_REDIRECT="https://vbvdev.b2clogin.com/vbvdev.onmicrosoft.com/b2c_1_signupandsignin/oauth2/v2.0/logout/?post_logout_redirect_uri=https://vbv-lernwelt.control.iterativ.ch"
fi
# script should fail when any process returns non zero code # script should fail when any process returns non zero code
set -ev set -ev
# create client # create client
npm run build npm run build
VITE_LOGOUT_REDIRECT=$LOCAL_LOGOUT
# create and push new docker container # create and push new docker container
## Note that images build with buildx do not appear in your docker images list, therefore the push true must be set ## Note that images build with buildx do not appear in your docker images list, therefore the push true must be set
docker buildx build --push=true --platform=linux/amd64 -f compose/django/Dockerfile -t "$REPO" -t "$LATEST" -t "$VERSION_TAG" --build-arg VERSION="$VERSION" --build-arg BUILD_TIMESTAMP="$BUILD_TIMESTAMP" --build-arg GIT_COMMIT="$(git log -1 --format=%h)" . docker buildx build --push=true --platform=linux/amd64 -f compose/django/Dockerfile -t "$REPO" -t "$LATEST" -t "$VERSION_TAG" --build-arg VERSION="$VERSION" --build-arg BUILD_TIMESTAMP="$BUILD_TIMESTAMP" --build-arg GIT_COMMIT="$(git log -1 --format=%h)" .