Fix deploy script

This commit is contained in:
teutat3s 2023-02-26 20:21:34 +01:00
parent d942d255eb
commit 90134c3365
Signed by: teutat3s
GPG key ID: 18DAE600A6BBE705

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# abort on first error # Abort on first error
set -e set -e
TAG="$1" TAG="$1"
@ -16,7 +16,7 @@ if [[ -z "$TAG" ]]; then
exit 1 exit 1
fi fi
# workaround for SSL: CERTIFICATE_VERIFY_FAILED error with docker-compose # Workaround for SSL: CERTIFICATE_VERIFY_FAILED error with docker-compose
if [ -z "$CURL_CA_BUNDLE" ]; then if [ -z "$CURL_CA_BUNDLE" ]; then
if [ ! -f ~/Downloads/cacert-2022-03-29.pem ]; then if [ ! -f ~/Downloads/cacert-2022-03-29.pem ]; then
echo echo
@ -28,21 +28,27 @@ if [ -z "$CURL_CA_BUNDLE" ]; then
export CURL_CA_BUNDLE=~/Downloads/cacert-2022-03-29.pem export CURL_CA_BUNDLE=~/Downloads/cacert-2022-03-29.pem
fi fi
# make sure we're using the local docker host for building our image # Make sure we're using the local docker host for building our image
eval "$(triton env --unset)" eval "$(triton env --unset)"
# build the image locally # Build the image locally
docker build --tag hub.greenbaum.cloud/miom.space:"$TAG" . docker build --tag registry.greenbaum.cloud/pub_solar/miom.space:"$TAG" .
# login to Greenbaum's private docker registry and push the image # Login to Greenbaum's private docker registry and push the image
docker login hub.greenbaum.cloud docker login registry.greenbaum.cloud
docker push hub.greenbaum.cloud/miom.space:"$TAG" docker push registry.greenbaum.cloud/pub_solar/miom.space:"$TAG"
# change DOCKER_HOST env var to remote docker host (Greenbaum's docker API) # Change DOCKER_HOST env var to remote docker host (Greenbaum's docker API)
eval "$(triton --account=pub_solar --url=https://lev-1.api.greenbaum.cloud env)" eval "$(triton --account=pub_solar --url=https://lev-1.api.greenbaum.cloud env)"
#
# Login to Greenbaum's private docker registry with Triton, too
docker login registry.greenbaum.cloud
# use our tag for docker-compose # Use our tag for docker-compose
export DEPLOY_TAG="$TAG" export DEPLOY_TAG="$TAG"
# deploy on Greenbaum Cloud # Pull the latest image
docker pull registry.greenbaum.cloud/pub_solar/miom.space:"$DEPLOY_TAG"
# Deploy on Greenbaum Cloud
docker-compose up -d docker-compose up -d