2018-05-27 01:42:52 +02:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-07-24 00:22:42 +02:00
|
|
|
build-alpine:
|
2018-05-27 02:03:02 +02:00
|
|
|
machine: true
|
2018-07-24 00:22:42 +02:00
|
|
|
working_directory: ~/repo/alpine
|
2018-05-27 02:03:02 +02:00
|
|
|
steps:
|
2018-07-24 00:22:42 +02:00
|
|
|
- checkout:
|
|
|
|
path: ~/repo
|
2018-08-03 06:36:10 +02:00
|
|
|
- run:
|
2018-05-27 02:06:08 +02:00
|
|
|
name: Build Postal Docker Container
|
2018-07-24 00:24:09 +02:00
|
|
|
command: docker build -t catdeployed/postal:latest -t catdeployed/postal:alpine .
|
2018-07-29 22:31:48 +02:00
|
|
|
- run:
|
|
|
|
name: Export Container
|
2018-08-03 06:36:10 +02:00
|
|
|
command: mkdir workspace && cd workspace && docker save --output postal_alpine.tar catdeployed/postal:alpine
|
2018-07-29 22:31:48 +02:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: workspace
|
|
|
|
paths:
|
|
|
|
- postal_alpine.tar
|
2018-07-24 00:30:08 +02:00
|
|
|
build-ubuntu:
|
|
|
|
machine: true
|
|
|
|
working_directory: ~/repo/ubuntu
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
path: ~/repo
|
|
|
|
- run:
|
|
|
|
name: Build Postal Docker Container
|
|
|
|
command: docker build -t catdeployed/postal:ubuntu .
|
2018-07-29 22:35:54 +02:00
|
|
|
- run:
|
|
|
|
name: Export Container
|
2018-07-29 22:40:03 +02:00
|
|
|
command: mkdir workspace && cd workspace && docker save --output postal_ubuntu.tar catdeployed/postal:ubuntu
|
2018-07-29 22:35:54 +02:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: workspace
|
|
|
|
paths:
|
|
|
|
- postal_ubuntu.tar
|
2018-07-29 22:04:06 +02:00
|
|
|
deploy:
|
|
|
|
machine: true
|
|
|
|
working_directory: ~/repo/ubuntu
|
|
|
|
steps:
|
2018-07-29 22:49:58 +02:00
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp/workspace
|
|
|
|
- run:
|
|
|
|
name: Load Alpine Image
|
|
|
|
command: docker load --input /tmp/workspace/postal_alpine.tar
|
|
|
|
- run:
|
|
|
|
name: Load Ubuntu Image
|
|
|
|
command: docker load --input /tmp/workspace/postal_ubuntu.tar
|
2018-07-30 02:53:00 +02:00
|
|
|
- run:
|
|
|
|
name: Tag alpine image as latest
|
|
|
|
command: docker tag catdeployed/postal:alpine catdeployed/postal:latest
|
2018-07-24 00:30:08 +02:00
|
|
|
- run:
|
|
|
|
name: Login to Docker Hub
|
|
|
|
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
|
|
|
- run:
|
2018-07-29 22:56:55 +02:00
|
|
|
name: Push Ubuntu Container to Docker Hub
|
2018-07-24 00:33:14 +02:00
|
|
|
command: docker push catdeployed/postal:ubuntu
|
2018-07-29 22:04:06 +02:00
|
|
|
- run:
|
2018-07-30 02:53:00 +02:00
|
|
|
name: Push Alpine Container to Docker Hub
|
2018-07-29 22:04:06 +02:00
|
|
|
command: docker push catdeployed/postal:alpine
|
2018-07-30 02:53:00 +02:00
|
|
|
- run:
|
|
|
|
name: Push Latest Container to Docker Hub
|
|
|
|
command: docker push catdeployed/postal:latest
|
2018-08-03 06:36:10 +02:00
|
|
|
deploy-dev:
|
|
|
|
machine: true
|
|
|
|
working_directory: ~/repo/ubuntu
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp/workspace
|
|
|
|
- run:
|
|
|
|
name: Load Alpine Image
|
|
|
|
command: docker load --input /tmp/workspace/postal_alpine.tar
|
|
|
|
- run:
|
|
|
|
name: Load Ubuntu Image
|
|
|
|
command: docker load --input /tmp/workspace/postal_ubuntu.tar
|
|
|
|
- run:
|
|
|
|
name: Rename Alpine Image Tag
|
|
|
|
command: docker tag catdeployed/postal:alpine catdeployed/postal:alpine-dev
|
|
|
|
- run:
|
|
|
|
name: Rename Ubuntu Image Tag
|
2018-08-03 06:55:49 +02:00
|
|
|
command: docker tag catdeployed/postal:ubuntu catdeployed/postal:ubuntu-dev
|
2018-08-03 06:36:10 +02:00
|
|
|
- run:
|
|
|
|
name: Tag alpine image as latest
|
|
|
|
command: docker tag catdeployed/postal:alpine catdeployed/postal:latest-dev
|
|
|
|
- run:
|
|
|
|
name: Login to Docker Hub
|
|
|
|
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
|
|
|
- run:
|
|
|
|
name: Push Ubuntu Container to Docker Hub
|
|
|
|
command: docker push catdeployed/postal:ubuntu-dev
|
|
|
|
- run:
|
|
|
|
name: Push Alpine Container to Docker Hub
|
|
|
|
command: docker push catdeployed/postal:alpine-dev
|
|
|
|
- run:
|
|
|
|
name: Push Latest Container to Docker Hub
|
|
|
|
command: docker push catdeployed/postal:latest-dev
|
2018-05-27 01:42:52 +02:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
nightly:
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 * * * *"
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
jobs:
|
2018-07-24 00:22:42 +02:00
|
|
|
- build-alpine
|
2018-07-24 00:30:08 +02:00
|
|
|
- build-ubuntu
|
2018-07-29 22:04:06 +02:00
|
|
|
- deploy:
|
|
|
|
requires:
|
|
|
|
- build-alpine
|
|
|
|
- build-ubuntu
|
|
|
|
filters:
|
|
|
|
branches:
|
2018-08-03 06:36:10 +02:00
|
|
|
only:
|
2018-07-29 22:04:06 +02:00
|
|
|
- master
|
2018-05-27 01:42:52 +02:00
|
|
|
commit:
|
|
|
|
jobs:
|
2018-07-24 00:22:42 +02:00
|
|
|
- build-alpine
|
2018-07-24 00:30:08 +02:00
|
|
|
- build-ubuntu
|
2018-07-29 22:18:39 +02:00
|
|
|
- deploy:
|
|
|
|
requires:
|
|
|
|
- build-alpine
|
|
|
|
- build-ubuntu
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
2018-08-03 06:36:10 +02:00
|
|
|
- deploy-dev:
|
|
|
|
requires:
|
|
|
|
- build-alpine
|
|
|
|
- build-ubuntu
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
2018-07-29 22:18:39 +02:00
|
|
|
- dev
|