22 lines
593 B
Bash
Executable file
22 lines
593 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
git pull
|
|
|
|
BUILD_VERSION=$(git rev-parse HEAD)
|
|
|
|
echo "$(date --utc +%FT%TZ): Releasing new server version. $BUILD_VERSION"
|
|
|
|
echo "$(date --utc +%FT%TZ): Running build..."
|
|
docker compose rm -f
|
|
docker compose build
|
|
|
|
OLD_CONTAINER=$(dockerps -aqf "name=site")
|
|
echo "$(date --utc +%FT%TZ): Scaling server up..."
|
|
BUILD_VERSION=$BUILD_VERSION docker compose up -d --no-deps --scale site=2 --no-recreate site
|
|
|
|
sleep 30
|
|
|
|
echo "$(date --utc +%FT%TZ): Scaling old server down..."
|
|
docker container rm -f $OLD_CONTAINER
|
|
docker compose up -d --no-deps --scale site=1 --no-recreate site
|