From e1d9118604e2f265c1e08ae1c19abf2cb1f76ad1 Mon Sep 17 00:00:00 2001 From: Tarskan <55380090+Tarskan@users.noreply.github.com> Date: Thu, 18 Nov 2021 21:37:00 +0100 Subject: [PATCH] :construction_worker: update CI --- .circleci/config.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e36e2ad..42f5ab6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,7 @@ jobs: paths: - node_modules key: dependencies-{{ checksum "package.json" }}-v1 + testUnit: <<: *shared-config steps: @@ -22,7 +23,27 @@ jobs: - restore_cache: key: dependencies-{{ checksum "package.json" }}-v1 - run: yarn test:unit - server-doc-deploy: + + docker-build-and-push: + working_directory: /dockerapp + docker: + - image: docker:17.05.0-ce-git + steps: + - checkout + - setup_remote_docker + - run: + name: Build application Docker image + command: docker build -t app . + - deploy: + name: Publish application to docker hub + command: | + docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD + docker tag app $DOCKER_HUB_USER_ID/tp_final_backend_six:$CIRCLE_BUILD_NUM + docker tag app $DOCKER_HUB_USER_ID/tp_final_backend_six:latest + docker push $DOCKER_HUB_USER_ID/tp_final_backend_six:$CIRCLE_BUILD_NUM + docker push $DOCKER_HUB_USER_ID/tp_final_backend_six:latest + + server-deploy: <<: *shared-config working_directory: ~/repo steps: @@ -43,7 +64,14 @@ workflows: - testUnit: requires: - build - - server-doc-deploy: + - docker-build-and-push: + requires: + - build + - testUnit + filters: + branches: + only: main + - server-deploy: requires: - build - testUnit