docker-backuppc/.circleci/config.yml
2018-09-17 10:34:06 +02:00

68 lines
1.8 KiB
YAML

version: 2
jobs:
build:
machine: true
steps:
- checkout
- run:
command: |
docker pull adferrand/backuppc || true
docker build --pull --cache-from adferrand/backuppc -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
test:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command:
docker load < /tmp/workspace/docker-backuppc.tar
- run:
command:
docker run --rm adferrand/backuppc echo 'Hello World!'
deploy:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command:
docker load < /tmp/workspace/docker-backuppc.tar
- run:
command:
echo "${DOCKER_PASS}" | docker login -u ${DOCKER_USER} --password-stdin
- deploy:
command: |
if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest; else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}}; fi
docker tag adferrand/backuppc adferrand/backuppc:${DOCKER_TAG}
docker push adferrand/backuppc:${DOCKER_TAG}
workflows:
version: 2
main-pipeline:
jobs:
- build:
filters:
tags:
only: /^[0-9.]+/
- test:
requires:
- build
filters:
tags:
only: /^[0-9.]+/
- deploy:
requires:
- test
filters:
branches:
only: /^(master|4|3)$/
tags:
only: /^[0-9.]+/