From 6ecab7d5794f2a5defa7fdfd0557584c01b325dd Mon Sep 17 00:00:00 2001 From: lamya-rey <61109480+lamya-rey@users.noreply.github.com> Date: Sun, 17 Jan 2021 17:14:52 +0100 Subject: [PATCH] :construction_worker: add config.yml --- .circleci/config.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..d59c00e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,60 @@ +version: 2 +workflows: + version: 2 + build-deploy: + jobs: + - build + - docker-build-and-push: + requires: + - build + - front-deploy: + requires: + - build +jobs: + build: + docker: + - image: circleci/node:dubnium-browsers + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }} + - dependencies- + - run: yarn global add node-gyp && yarn install + - save_cache: + paths: + - node_modules + key: dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }} + + front-deploy: + docker: + - image: circleci/node:dubnium-browsers + steps: + - attach_workspace: + at: /tmp + - run: + name: install netlify + command: sudo npm install netlify-cli -g + - run: + name: Deploy app + command: netlify deploy --prod --auth $NETLIFY_AUTH_TOKEN --dir /tmp/server-doc --site $NETLIFY_SITE_ID + + docker-build-and-push: + docker: + - image: docker:17.05.0-ce-git + steps: + - checkout + - setup_remote_docker + - run: + name: Build application Docker image + command: | + docker build --cache-from=app -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/devops-front-final:$CIRCLE_BUILD_NUM + docker tag app $DOCKER_HUB_USER_ID/devops-front-final:1.0 + docker push $DOCKER_HUB_USER_ID/devops-front-final:$CIRCLE_BUILD_NUM + docker push $DOCKER_HUB_USER_ID/devops-front-final:1.0 +