From de9fafb8e635b97a5bb4de171f62bf8feae67d77 Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Mon, 27 Feb 2023 16:48:08 +0100 Subject: [PATCH] Init deployment via drone CI --- .drone.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ deploy.sh | 28 ---------------------------- 2 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..dbb19dd --- /dev/null +++ b/.drone.yml @@ -0,0 +1,49 @@ +kind: pipeline +type: docker +name: check-build + +steps: + - name: check + image: denoland/deno:alpine-1.30.3 + commands: + - ./build.sh + when: + event: + - push + + - name: build documentation image + image: plugins/docker + settings: + registry: registry.greenbaum.cloud + repo: registry.greenbaum.cloud/pub_solar/miom.space + tags: + - latest + - ${DRONE_TAG} + username: + from_secret: docker_username + password: + from_secret: docker_password + when: + event: + - tag + + - name: deploy + image: registry.greenbaum.cloud/library/triton-docker + environment: + TRITON_SSH_KEY: + from_secret: triton_ssh_key + TRITON_ACCOUNT: + from_secret: triton_account + TRITON_URL: https://lev-1.api.greenbaum.cloud + TRITON_KEY_ID: 59:9f:5a:6f:c4:e2:3b:32:7f:13:1f:de:b7:59:80:85 + PROJECT_NAME: miomspace + commands: + - mkdir -p /home/node/.ssh + - echo -e "$TRITON_SSH_KEY" > /home/node/.ssh/id_rsa + - ./deploy.sh $DRONE_TAG + when: + event: + - promote + - rollback + target: + - production diff --git a/deploy.sh b/deploy.sh index 208ae83..9e3644f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -16,34 +16,6 @@ if [[ -z "$TAG" ]]; then exit 1 fi -# 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 - echo "Couldn't find required CURL_CA_BUNDLE env variable..." - echo "Downloading https://curl.se/ca/cacert-2022-03-29.pem to ~/Downloads/cacert-2022-03-29.pem" - echo - curl https://curl.se/ca/cacert-2022-03-29.pem -o ~/Downloads/cacert-2022-03-29.pem - fi - export CURL_CA_BUNDLE=~/Downloads/cacert-2022-03-29.pem -fi - -# Make sure we're using the local docker host for building our image -eval "$(triton env --unset)" - -# 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 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) -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 export DEPLOY_TAG="$TAG"