24 lines
899 B
Bash
Executable File
24 lines
899 B
Bash
Executable File
#!/bin/bash
|
|
|
|
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"
|
|
|
|
# script should fail when any process returns non zero code
|
|
set -ev
|
|
|
|
# create client
|
|
npm run build
|
|
|
|
## Note that images build with buildx do not appear in your docker images list, therefore the push true must be set
|
|
|
|
# create and push new docker container
|
|
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) .
|
|
|
|
|
|
#deploy to caprover, explicitly use the version tag... so if there is a mismach you get an error message
|
|
caprover deploy -h https://captain.control.iterativ.ch -a vbv-lernwelt -i docker.io/"$VERSION_TAG"
|
|
|