From bb14e26971bc5514d91405fa440721331e98848e Mon Sep 17 00:00:00 2001 From: Francois Lannoy Date: Tue, 3 Nov 2020 22:06:31 +0100 Subject: [PATCH] Push image to docker hub --- .circleci/config.yml | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7707a03..59c1a1d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,15 @@ workflows: - build - e2e: requires: - - build + - build + - build_docker: + requires: + - e2e + - lint + - test + - publish_image: + requires: + - build_docker jobs: build: docker: @@ -65,4 +73,30 @@ jobs: command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: Launching e2e test - command: yarn test:e2e \ No newline at end of file + command: yarn test:e2e + build_docker: + environment: + IMAGE_NAME: sgttabouret/my-awesome-ci-expr + docker: + image: circleci/buildpack-deps:stretch + steps: + - checkout + - setup_remote_docker + - run: docker image build --tag $IMAGE_NAME:app . + - run: docker save -o image.tar $IMAGE_NAME + - persist_to_workspace: + root: . + paths: + - ./image.tar + publish_image: + steps: + - attach_workspace: + at: /tmp/workspace + - setup_remote_docker + - run: + name: Login and Publish to DockerHub + command: + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASS + docker tag $IMAGE_NAME:latest $IMAGE_NAME:$CIRCLE_BUILD_NUM + docker push $IMAGE_NAME +