From 9636545980f156255d8a2396a774e31a5d715f5a Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Sat, 29 Feb 2020 09:54:02 +0300 Subject: [PATCH] Try to pull image --- .circleci/config.yml | 31 ++++++++++++++++--------------- docker/deploy-prod | 4 +++- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fc47d5..a79fd85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,15 +43,16 @@ jobs: - run: docker build --file ./docker/Dockerfile.prod --tag cr.yandex/crplfk0168i4o8kd7ade/dayoff . - run: docker push cr.yandex/crplfk0168i4o8kd7ade/dayoff - # deploy_app: - # docker: - # - image: alpine:3.10.3 - # steps: - # - checkout - # - add_ssh_keys - # - run: apk add -u openssh-client - # - run: ssh-keyscan vakhrushev.me >> ~/.ssh/known_hosts - # - run: cat docker/deploy-prod | ssh dayoff@vakhrushev.me + deploy_app: + docker: + - image: alpine:3.10.3 + steps: + - checkout + - add_ssh_keys + - run: apk add -u openssh-client + - run: ssh-keyscan vakhrushev.me >> ~/.ssh/known_hosts + - run: echo "$YANDEX_CLOUD_DOCKER_REGISTRY_KEY" | ssh dayoff@vakhrushev.me -T "cat > /home/dayoff/yandex_cloud_docker_registry_key.json" + - run: cat docker/deploy-prod | "$YANDEX_CLOUD_DOCKER_REGISTRY_KEY=$YANDEX_CLOUD_DOCKER_REGISTRY_KEY ssh dayoff@vakhrushev.me" workflows: version: 2 @@ -66,9 +67,9 @@ workflows: filters: branches: only: master - # - deploy_app: - # requires: - # - build_docker_image - # filters: - # branches: - # only: master + - deploy_app: + requires: + - build_docker_image + filters: + branches: + only: master diff --git a/docker/deploy-prod b/docker/deploy-prod index 46c1dd8..32992d4 100755 --- a/docker/deploy-prod +++ b/docker/deploy-prod @@ -4,7 +4,7 @@ set -eux source /home/dayoff/.env -IMAGE=anwinged/dayoff +IMAGE=cr.yandex/crplfk0168i4o8kd7ade/dayoff DATA_PATH=/home/dayoff/data CONTAINER_NAME="${CONTAINER_PREFIX}-server" @@ -16,6 +16,8 @@ if [ -t 1 ] ; then TTY=-t fi +echo "$YANDEX_CLOUD_DOCKER_REGISTRY_KEY" | docker login --username json_key --password-stdin cr.yandex + docker pull "${IMAGE}" docker stop "${CONTAINER_NAME}" || true