orbs: node: circleci/node@3.0.0 version: 2.1 workflows: tests: jobs: - hello - install - lint - test - database - build_docker - publish_image jobs: hello: docker: - image: "circleci/node:12" steps: - checkout - run: "echo \"hello world\"" install: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-packages-{{ checksum "yarn.lock"}} - run : yarn global add node-gyp - run : yarn install - save_cache: key: yarn-packages-{{ checksum "yarn.lock"}} paths: - ./node_modules lint: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-packages-{{ checksum "yarn.lock"}} - run : yarn lint - run : yarn format:check test: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-packages-{{ checksum "yarn.lock"}} - run : yarn test:ci database: docker: - image: "circleci/node:12" environment: DATABASE_URL: postgres://psqluser:psqlpassword@localhost:5432/psdb JWT_SECRET: some string yo want API_PORT: 3000 API_HOST: localhost API_PROTOCOL: http - image: "circleci/postgres:9.6.2-alpine" environment: POSTGRES_USER: psqluser POSTGRES_PASSWORD: psqlpassword POSTGRES_DB: psdb steps: - checkout - restore_cache: key: yarn-packages-{{ checksum "yarn.lock"}} - run : yarn test:e2e build_docker: environment: IMAGE_NAME: 150597dal/my-awesome-ci-expr docker: - image: circleci/buildpack-deps:stretch steps: - checkout - setup_remot_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: environment: IMAGE_NAME: 150597dal/my-awesome-ci-expr docker: - image: circleci/buildpack-deps:stretch steps: - attache_workspace: at: /tmp/workspace - setup_remote_docker - run: docker load -i /tmp/workspace/image.tar - run: name: Login and Publish to Docker Hub commande: echo "$DOCKERHUB_PASS" | docker login --username 150597dal --password-stdin docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM docker tag $IMAGE_NAME:app $IMAGE_NAME:latest docker push $IMAGE_NAME:$CIRCLE_BUILD_NUM docker push $IMAGE_NAME:latest