From 0c13bcf6aa392794fb069a1c9e341ff0f04a9d6d Mon Sep 17 00:00:00 2001 From: ndrg13 <72130242+ndrg13@users.noreply.github.com> Date: Thu, 5 Nov 2020 20:41:51 +0100 Subject: [PATCH] Update config.yml --- .circleci/config.yml | 55 +++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9d7c17e..bb810fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,21 +1,21 @@ version: 2.1 executors: node-executor: - docker: - - image: circleci/node:12 - auth: - username: $DOCKERHUB_LOGIN - password: $DOCKERHUB_PASSWORD + docker: + - image: circleci/node:12 + auth: + username: $DOCKERHUB_LOGIN + password: $DOCKERHUB_PASSWORD node-and-postgresql-executor: - docker: - - image: circleci/node:12 - auth: - username: $DOCKERHUB_LOGIN - password: $DOCKERHUB_PASSWORD - - image: circleci/postgres:9.6.2-alpine - auth: - username: $DOCKERHUB_LOGIN - password: $DOCKERHUB_PASSWORD + docker: + - image: circleci/node:12 + auth: + username: $DOCKERHUB_LOGIN + password: $DOCKERHUB_PASSWORD + - image: circleci/postgres:9.6.2-alpine + auth: + username: $DOCKERHUB_LOGIN + password: $DOCKERHUB_PASSWORD environment: DATABASE_URL: "postgres://postgres:$POSTGRES_PASSWORD@localhost:5432/postgres" JWT_SECRET: string @@ -25,6 +25,12 @@ executors: POSTGRES_USER: postgres POSTGRES_PASSWORD: $POSTGRES_PASSWORD POSTGRES_DB: postgres + buildpack: + docker: + - image: circleci/buildpack-deps:stretch + auth: + username: $DOCKERHUB_LOGIN + password: $DOCKERHUB_PASSWORD jobs: build: executor: node-executor @@ -68,6 +74,23 @@ jobs: - run: name: Run end to end test command: yarn test:e2e + push_to_hub: + executor: buildpack + environment: + IMAGE_NAME: testimg + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: docker build -t $IMAGE_NAME:app . + - run: + name: Login to Docker Hub + command: | + echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_LOGIN" --password-stdin + - run: + name: Push to Docker Hub + command: docker push $IMAGE_NAME:app workflows: version: 2 integration: @@ -82,3 +105,7 @@ workflows: - test_end_to_end: requires: - build + - push_to_hub: + requires: + - test + - test_end_to_end