version: 2.1 jobs: install-dependencies: docker: - image: circleci/node:dubnium-browsers steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }} - dependencies- - run: yarn global add node-gyp && yarn install - save_cache: paths: - node_modules key: dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }} build: docker: - image: circleci/node:dubnium-browsers steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }} - dependencies- - run: yarn build - run: name: Copy deployment artifacts to workspace command: | cp dist/ /tmp/dist -r - store_artifacts: path: /tmp/dist - persist_to_workspace: root: /tmp paths: - dist fondend-deploy: docker: - image: circleci/node:dubnium-browsers working_directory: ~/dist steps: - attach_workspace: at: /tmp - run: name: Deploy app command: | npx netlify-cli deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir /tmp/dist --prod docker-buildandpush: docker: - image: docker:17.05.0-ce-git steps: - checkout - setup_remote_docker - run: name: Build application Docker image command: | docker build --cache-from=app -t app . - deploy: name: Publish application to docker hub command: | docker login -e sipetchawoudanieljordan@yahoo.fr -u sipedaniel -p $DOCKER_HUB_PASSWORD docker tag app sipedaniel/frontend-finalproject:$CIRCLE_BUILD_NUM docker tag app sipedaniel/frontend-finalproject:latest docker push sipedaniel/frontend-finalproject:$CIRCLE_BUILD_NUM docker push sipedaniel/frontend-finalproject:latest workflows: version: 2.1 build-deploy_frontend: jobs: - install-dependencies - build: requires: - install-dependencies - fondend-deploy: requires: - build - docker-buildandpush: requires: - build