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
# abort on first error
# Abort on first error
set -e
TAG="$1"
@ -16,7 +16,7 @@ if [[ -z "$TAG" ]]; then
exit 1
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 [ ! -f ~/Downloads/cacert-2022-03-29.pem ]; then
echo
@ -28,21 +28,27 @@ if [ -z "$CURL_CA_BUNDLE" ]; then
export CURL_CA_BUNDLE=~/Downloads/cacert-2022-03-29.pem
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)"
# build the image locally
docker build --tag hub.greenbaum.cloud/miom.space:"$TAG" .
# Build the image locally
docker build --tag registry.greenbaum.cloud/pub_solar/miom.space:"$TAG" .
# login to Greenbaum's private docker registry and push the image
docker login hub.greenbaum.cloud
docker push hub.greenbaum.cloud/miom.space:"$TAG"
# Login to Greenbaum's private docker registry and push the image
docker login registry.greenbaum.cloud
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)"
#
# 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"
# 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