# Configure CircleCI version: 2 jobs: build: machine: true steps: - checkout - run: command: docker build -t adferrand/backuppc . - run: command: | mkdir -p workspace docker save adferrand/backuppc > workspace/docker-backuppc.tar - persist_to_workspace: root: workspace paths: - docker-backuppc.tar deploy: machine: true steps: - attach_workspace: at: /tmp/workspace - run: command: echo 'if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}} fi; export DOCKER_TAG' >> $BASH_ENV - run: command: docker load < /tmp/workspace/docker-backuppc.tar - deploy: command: | if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}} fi; echo ${DOCKER_TAG} workflows: version: 2 build-n-deploy: jobs: - build: filters: tags: only: ^[0-9.]+ - deploy: requires: - build filters: tags: only: ^[0-9.]+