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