Yield generated for c5930fa1-99d2-4a57-8ebb-edc1beb2919e
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.
 
 
 

107 lines
3.2 KiB

version: 2
jobs:
build:
docker:
- image: circleci/node:dubnium-browsers
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }}
# fallback to using the latest cache if no exact match is found
- dependencies-
- run: yarn global add node-gyp && yarn install
- run: yarn global add serve
- run: yarn run build
- run: yarn run test
# - run: yarn run serve
- save_cache:
paths:
- node_modules
key: dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }}
artifact-save:
docker:
- image: circleci/node:dubnium-browsers
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }}
# fallback to using the latest cache if no exact match is found
- dependencies-
- run: yarn build
- run:
name: Copy deployment artifacts to workspace
command: |
cp ./dist /tmp/server -r
- store_artifacts:
path: /tmp/server
- persist_to_workspace:
root: /tmp
paths:
- server
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
netlifly-deploy:
docker:
- image: circleci/node:dubnium-browsers
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}-{{ .Environment.CACHE_VERSION }}
# fallback to using the latest cache if no exact match is found
- dependencies-
- attach_workspace:
at: /tmp
- run:
name: Deploy app
command: sudo npm install netlify-cli -g && netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFLY_DEVOPSFINAL_TOKEN --prod --dir /tmp/server
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
docker_build_push:
working_directory: /dockerapp
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 $DOCKER_HUB_EMAIL -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker tag app $DOCKERHUB_USERNAME/dev_ops_front_container:$CIRCLE_BUILD_NUM
docker tag app $DOCKERHUB_USERNAME/dev_ops_front_container:latest
docker push $DOCKERHUB_USERNAME/dev_ops_front_container:$CIRCLE_BUILD_NUM
docker push $DOCKERHUB_USERNAME/dev_ops_front_container:latest
workflows:
version: 2
build-deploy:
jobs:
- build
- artifact-save:
requires:
- build
- netlifly-deploy:
requires:
- build
- artifact-save
- docker_build_push:
requires:
- build