From 68955cabc62d298b6a0bd03a6f31f6af1b1b6b05 Mon Sep 17 00:00:00 2001 From: Zhantoroev Date: Wed, 25 May 2022 22:46:34 +0600 Subject: [PATCH] circle ci --- .circleci/config.yml | 77 ++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 42258cf..a4d7033 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,52 +1,31 @@ -on: 2.1 +orbs: + docker: circleci/docker@1.5.0 +version: 2.1 executors: - docker: - environment: - IMAGE_NAME: smz001/robofriends - docker: - - image: circleci/buildpack-deps:stretch + docker-publisher: + environment: + IMAGE_NAME: ndukwearm19docker/docker-node-app + docker: # Each job requires specifying an executor + # (either docker, macos, or machine), see + — image: circleci/node:latest + auth: + username: $DOCKERHUB_USERNAME + password: $DOCKERHUB_PASS jobs: - build: - executor: docker - 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 - docker: - executor: docker - 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 - docker push $IMAGE_NAME:latest + publishLatestToHub: + executor: docker-publisher + + steps: + — checkout + — setup_remote_docker + — run: + name: Publish Docker Image to Docker Hub + command: | + echo “$DOCKERHUB_PASSWORD” | docker login -u “$DOCKERHUB_USERNAME” — password-stdin + docker build -t $IMAGE_NAME . + docker push $IMAGE_NAME:latest workflows: - version: 2 - build-master: - jobs: - - build: - filters: - branches: - only: master - - docker: - requires: - - build - filters: - branches: - only: master + version: 2 + build-master: + jobs: + — publishLatestToHub \ No newline at end of file