From 3a02d8abc818736157b5bea19e2c02f54c444ae7 Mon Sep 17 00:00:00 2001 From: GreeshmaLekkala <123832184+GreeshmaLekkala@users.noreply.github.com> Date: Wed, 15 Mar 2023 23:56:11 -0400 Subject: [PATCH 1/2] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b05b7f4..dabde94 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ version: 2.1 executors: docker-publisher: environment: - IMAGE_NAME: shresthaajay/node-hello-world-nov3 + IMAGE_NAME: greeshmalekkala/node-hello-world-nov3 docker: - image: circleci/buildpack-deps:stretch jobs: From 022182bc9c84273eedb42fe261783a423745f7b1 Mon Sep 17 00:00:00 2001 From: GreeshmaLekkala <123832184+GreeshmaLekkala@users.noreply.github.com> Date: Thu, 16 Mar 2023 16:09:03 -0400 Subject: [PATCH 2/2] Add .circleci/config.yml --- .circleci/config.yml | 78 ++++++++++---------------------------------- 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dabde94..37edaac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,63 +1,21 @@ -## This will build and publish docker container to docker hub. -# -# TO DO: -# 1. Set the environment variables DOCKERHUB_USERNAME and DOCKERHUB_PASS -# 2. Change docker hub repo to yours, i.e,. replace shresthaajay/node-hello-world with your repo. -# -## Reference: https://circleci.com/blog/using-circleci-workflows-to-replicate-docker-hub-automated-builds/ - +# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml' version: 2.1 -executors: - docker-publisher: - environment: - IMAGE_NAME: greeshmalekkala/node-hello-world-nov3 - docker: - - image: circleci/buildpack-deps:stretch -jobs: - build: - executor: docker-publisher - steps: - - checkout - - setup_remote_docker - - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:latest . - - run: - name: Archive Docker image - command: docker save -o image.tar $IMAGE_NAME - - persist_to_workspace: - root: . - paths: - - ./image.tar - publish-latest: - executor: docker-publisher - steps: - - attach_workspace: - at: /tmp/workspace - - setup_remote_docker - - run: - name: Load archived Docker image - command: docker load -i /tmp/workspace/image.tar - - run: - name: Publish Docker Image to Docker Hub - command: | - echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - IMAGE_TAG="0.0.${CIRCLE_BUILD_NUM}" - docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG - docker push $IMAGE_NAME:latest - docker push $IMAGE_NAME:$IMAGE_TAG + +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# See: https://circleci.com/docs/2.0/orb-intro/ +orbs: + node: circleci/node@4.7 + +# Invoke jobs via workflows +# See: https://circleci.com/docs/2.0/configuration-reference/#workflows workflows: - version: 2 - build-master: + sample: # This is the name of the workflow, feel free to change it to better match your workflow. + # Inside the workflow, you define the jobs you want to run. jobs: - - build: - filters: - branches: - only: main - - publish-latest: - requires: - - build - filters: - branches: - only: main + - node/test: + # This is the node version to use for the `cimg/node` tag + # Relevant tags can be found on the CircleCI Developer Hub + # https://circleci.com/developer/images/image/cimg/node + version: '16.10' + # If you are using yarn, change the line below from "npm" to "yarn" + pkg-manager: npm