diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..5673314 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,109 @@ +version: 2 +jobs: + install: &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 + + build: + <<: *shared-config + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "package.json" }}-v1 + - dependencies- + - run: yarn build + + front-netlify-deploy: + <<: *shared-config + steps: + - checkout + - attach_workspace: + at: /tmp + - run: + name: Install netlify + command: | + yarn add -D netlify-cli + - run: + name: Deploy app + command: yarn netlify deploy --auth $NETLIFY_AUTH_TOKEN --dir /tmp/repo --site $NETLIFY_SITE_ID --prod + + docker-build-and-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 $PROD_EMAIL -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + docker tag app $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:$CIRCLE_BUILD_NUM + docker tag app $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:latest + docker push $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:$CIRCLE_BUILD_NUM + docker push $DOCKERHUB_USERNAME/$DOCKERHUB_APP_NAME:latest + +workflows: + version: 2 + build-test-and-lint: + jobs: + - build + - lint: + requires : + - build + - back-test-unit: + requires: + - build + - back-test-e2e: + requires: + - build + - back-deploy-heroku: + requires: + - build + - lint + - back-test-unit + - back-test-e2e + filters: + branches: + only: main + - server-doc-build: + requires: + - build + - lint + - back-test-e2e + - back-test-unit + filters: + branches: + only: main + - server-doc-deploy: + requires: + - server-doc-build + filters: + branches: + only: main + - docker-build-and-push: + requires: + - build + - lint + - back-test-e2e + - back-test-unit + filters: + branches: + only: main \ No newline at end of file diff --git a/.circleci/netlify.toml b/.circleci/netlify.toml new file mode 100644 index 0000000..fd10960 --- /dev/null +++ b/.circleci/netlify.toml @@ -0,0 +1,21 @@ +# example netlify.toml +[build] + command = "yarn run build" + functions = "netlify/functions" + publish = "_site" + + ## Uncomment to use this redirect for Single Page Applications like create-react-app. + ## Not needed for static site generators. + #[[redirects]] + # from = "/*" + # to = "/index.html" + # status = 200 + + ## (optional) Settings for Netlify Dev + ## https://github.com/netlify/cli/blob/main/docs/netlify-dev.md#project-detection + #[dev] + # command = "yarn start" # Command to start your dev server + # port = 3000 # Port that the dev server will be listening on + # publish = "dist" # Folder with the static content for _redirect file + + ## more info on configuring this file: https://www.netlify.com/docs/netlify-toml-reference/