Yield generated for 1433ca7c-8f05-4e65-9f6e-83a4cdb57296
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

81 lines
2.1 KiB

version: 2
jobs:
build: &shared-config
docker:
- image: circleci/node:lts-fermium
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}-v1
- dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: dependencies-{{ checksum "package.json" }}-v1
testUnit:
<<: *shared-config
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}-v1
- run: yarn test:unit
docker-build-and-push:
working_directory: /dockerapp
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker:
version: 19.03.13
- run:
name: Build application Docker image
command: docker build -t app .
- deploy:
name: Publish application to docker hub
command: |
docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD
docker tag app $DOCKER_HUB_USER_ID/tp_final_backend_six:$CIRCLE_BUILD_NUM
docker tag app $DOCKER_HUB_USER_ID/tp_final_backend_six:latest
docker push $DOCKER_HUB_USER_ID/tp_final_backend_six:$CIRCLE_BUILD_NUM
docker push $DOCKER_HUB_USER_ID/tp_final_backend_six:latest
server-deploy:
<<: *shared-config
working_directory: ~/repo
steps:
- attach_workspace:
at: /tmp
- run:
name: Install netlify
command: yarn add netlify-cli -D
- run:
name: Deploy app
command: yarn netlify deploy --prod --dir=/repo
workflows:
version: 2
build-test-and-lint:
jobs:
- build
- testUnit:
requires:
- build
- docker-build-and-push:
requires:
- build
- testUnit
filters:
branches:
only: main
- server-deploy:
requires:
- build
- testUnit
filters:
branches:
only: main