Merge azure_deploy.sh into caprover_deploy.sh
This commit is contained in:
parent
b967147ff5
commit
df9b608d6e
|
|
@ -44,36 +44,36 @@ fi
|
||||||
npm run build
|
npm run build
|
||||||
python server/manage.py collectstatic --no-input
|
python server/manage.py collectstatic --no-input
|
||||||
|
|
||||||
# create and push new docker container
|
if [[ "$APP_NAME" == "prod-azure" ]]; then
|
||||||
VERSION=$(git log -1 --pretty=%h)
|
|
||||||
REPO="iterativ/vbv-lernwelt-django"
|
|
||||||
LATEST="${REPO}:latest"
|
|
||||||
BUILD_TIMESTAMP=$(date '+%F_%H:%M:%S')
|
|
||||||
VERSION_TAG="${REPO}:$VERSION"
|
|
||||||
docker build --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 push "$VERSION_TAG"
|
|
||||||
|
|
||||||
if [[ "$APP_NAME" == "vbv-azure" ]]; then
|
|
||||||
# build and push azure docker container
|
# build and push azure docker container
|
||||||
docker build --platform linux/amd64 -f compose/django/Dockerfile -t iterativ/vbv-lernwelt-django:azure .
|
docker build --platform linux/amd64 -f compose/django/Dockerfile -t iterativ/vbv-lernwelt-django:azure .
|
||||||
docker image push iterativ/vbv-lernwelt-django:azure
|
docker image push iterativ/vbv-lernwelt-django:azure
|
||||||
fi
|
else
|
||||||
|
# create and push new docker container
|
||||||
# caprover specific deployment
|
VERSION=$(git log -1 --pretty=%h)
|
||||||
APP_URL="$APP_NAME.control.iterativ.ch"
|
REPO="iterativ/vbv-lernwelt-django"
|
||||||
|
LATEST="${REPO}:latest"
|
||||||
echo "Checking if $APP_URL is available..."
|
BUILD_TIMESTAMP=$(date '+%F_%H:%M:%S')
|
||||||
if ! curl --output /dev/null --silent --head --fail "$APP_URL"; then
|
VERSION_TAG="${REPO}:$VERSION"
|
||||||
echo "HTTP request to $APP_URL did not return a 200 status code, so we need to create the caprover app"
|
docker build --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)" .
|
||||||
python caprover_cleanup.py -a "$APP_NAME*" --automated
|
docker push "$VERSION_TAG"
|
||||||
python caprover_create_app.py -a "$APP_NAME"
|
|
||||||
fi
|
# caprover specific deployment
|
||||||
|
APP_URL="$APP_NAME.control.iterativ.ch"
|
||||||
# deploy to caprover, explicitly use the version tag... so if there is a mismatch you get an error message
|
|
||||||
caprover deploy -h https://captain.control.iterativ.ch -a "$APP_NAME" -i docker.io/"$VERSION_TAG"
|
echo "Checking if $APP_URL is available..."
|
||||||
|
if ! curl --output /dev/null --silent --head --fail "$APP_URL"; then
|
||||||
if [ -n "$CI" ]; then
|
echo "HTTP request to $APP_URL did not return a 200 status code, so we need to create the caprover app"
|
||||||
echo "Running within Bitbucket Pipelines"
|
python caprover_cleanup.py -a "$APP_NAME*" --automated
|
||||||
export CAPROVER_APP_URL="$APP_URL"
|
python caprover_create_app.py -a "$APP_NAME"
|
||||||
echo "https://$CAPROVER_APP_URL" >/tmp/caprover_app_url.txt
|
fi
|
||||||
|
|
||||||
|
# deploy to caprover, explicitly use the version tag... so if there is a mismatch you get an error message
|
||||||
|
caprover deploy -h https://captain.control.iterativ.ch -a "$APP_NAME" -i docker.io/"$VERSION_TAG"
|
||||||
|
|
||||||
|
if [ -n "$CI" ]; then
|
||||||
|
echo "Running within Bitbucket Pipelines"
|
||||||
|
export CAPROVER_APP_URL="$APP_URL"
|
||||||
|
echo "https://$CAPROVER_APP_URL" >/tmp/caprover_app_url.txt
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue