mirror of
https://github.com/adferrand/docker-backuppc.git
synced 2023-11-05 04:40:26 +01:00
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
version: 2
|
|
jobs:
|
|
build:
|
|
machine: true
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
docker pull adferrand/backuppc || true
|
|
docker build --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
|
|
deploy:
|
|
machine: true
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- run:
|
|
command:
|
|
docker load < /tmp/workspace/docker-backuppc.tar
|
|
- run:
|
|
command:
|
|
docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
|
|
- 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
|
|
build-n-deploy:
|
|
jobs:
|
|
- build:
|
|
filters:
|
|
tags:
|
|
only: ^[0-9.]+
|
|
- deploy:
|
|
requires:
|
|
- build
|
|
filters:
|
|
tags:
|
|
only: ^[0-9.]+
|