dangerzone/dangerzone-converter/.circleci/config.yml

108 lines
2.5 KiB
YAML

version: 2.1
executors:
docker-publisher:
environment:
IMAGE_NAME: flmcode/dangerzone
docker:
- image: circleci/python
jobs:
build:
executor: docker-publisher
steps:
- checkout
- setup_remote_docker
- run:
name: Build docker image
command: docker build -t $IMAGE_NAME:latest .
- run:
name: Archive docker image
command: docker save -o image.tar $IMAGE_NAME
- persist_to_workspace:
root: .
paths:
- ./image.tar
publish-latest:
executor: docker-publisher
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load archived docker image
command: docker load -i /tmp/workspace/image.tar
- run:
name: Publish image to docker Hub
command: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
docker push $IMAGE_NAME:latest
publish-tag:
executor: docker-publisher
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load archived docker image
command: docker load -i /tmp/workspace/image.tar
- run:
name: Publish image to docker Hub
command: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
IMAGE_TAG=${CIRCLE_TAG/v/''}
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$IMAGE_TAG
workflows:
version: 2
build-stable:
jobs:
- build:
filters:
branches:
only: stable
- publish-latest:
requires:
- build
filters:
branches:
only: stable
build-tags:
jobs:
- build:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- publish-tag:
requires:
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
monthly:
triggers:
- schedule:
cron: "0 0 1 * *"
filters:
branches:
only: stable
jobs:
- build:
filters:
branches:
only: stable
- publish-latest:
requires:
- build
filters:
branches:
only: stable