---
# Use "default as the reponame's default so we can run this generic script locally
#

version: 2
jobs:
  build:
    docker:
      - image: damacus/docker-builder:latest
    working_directory: ~/project
    steps:
      - checkout
      - setup_remote_docker:
          version: 17.05.0-ce
      - restore_cache:
          keys:
            - v2-{{ arch }}-{{ .Branch }}-{{ checksum "Dockerfile" }}
          paths:
            - /caches/app.tar
      - run:
          name: Build Image
          command: |
            apk add --no-cache py-pip
            pip install docker-compose==1.12.0
            source ./.docker/functions.sh
            build
            docker-compose -f .docker/docker-compose.yaml up -d
            inspec exec tests -t docker://docker_composer_builder_1 --controls=composer-commands

      - save_cache:
          key: v2-{{ arch }}-{{ .Branch }}-{{ checksum "Dockerfile" }}
          paths:
            - /caches/app.tar
      - deploy:
          name: Push Image
          context: org-global
          command: |
            source "./.docker/functions.sh"
            push

workflows:
  version: 2
  build:
    jobs:
      - build:
          context: org-global
  nightly:
    triggers:
      - schedule:
          cron: "0 0 * * *"
          filters:
            branches:
              only:
                - master
    jobs:
      - build

---
# Use "default as the reponame's default so we can run this generic script locally
#

version: 2
jobs:
  build:
    docker:
      - image: damacus/docker-builder:latest
    working_directory: ~/project
    steps:
      - checkout
      - setup_remote_docker:
          version: 17.05.0-ce
      - restore_cache:
          keys:
            - v2-{{ arch }}-{{ .Branch }}-{{ checksum "Dockerfile" }}
          paths:
            - /caches/app.tar
      - run:
          name: Build Image
          command: |
            apk add --no-cache py-pip
            pip install docker-compose==1.12.0
            source ./.docker/functions.sh
            build
            docker-compose -f .docker/docker-compose.yaml up -d
            inspec exec tests -t docker://docker_composer_builder_1 --controls=composer-commands

      - save_cache:
          key: v2-{{ arch }}-{{ .Branch }}-{{ checksum "Dockerfile" }}
          paths:
            - /caches/app.tar
      - deploy:
          name: Push Image
          context: org-global
          command: |
            source "./.docker/functions.sh"
            push

workflows:
  version: 2
  build:
    jobs:
      - build:
          context: org-global
  nightly:
    triggers:
      - schedule:
          cron: "0 0 * * *"
          filters:
            branches:
              only:
                - master
    jobs:
      - build
          context: org-global

Add context to circleci job
Add context to circleci job
