use circleci workflows for test, docker build, and deploy to dockerhub

- renamed "build" job to "test" and created "test" workflow
  - will run on all pull requests and merges into master
- "build" job now builds isce docker container
- "deploy" job will deploy docker image to dockerhub at isce/isce2 (https://cloud.docker.com/u/isce/repository/list)
  - need to configure DOCKER_PASS and DOCKER_USER in "Build Settings" -> "Envrionment Variables" on circleci
- created "build-deploy" workflow to run "build" job then "deploy" job on merge of PR to master
- created "build-periodically" workflow to run "build-periodically" job then "deploy" job once a week
LT1AB
Gerald Manipon 2019-05-08 09:19:05 -07:00
parent 70426ef532
commit 1ca8fec597
1 changed files with 111 additions and 3 deletions

View File

@ -1,6 +1,6 @@
version: 2 version: 2.1
jobs: jobs:
build: test:
docker: docker:
- image: hysds/pge-base:latest - image: hysds/pge-base:latest
user: root user: root
@ -79,5 +79,113 @@ jobs:
topsApp.py --help --steps topsApp.py --help --steps
stripmapApp.py --help --steps stripmapApp.py --help --steps
python3 -c "import isce" python3 -c "import isce"
build:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
python-dev py-pip bash pigz build-base libffi-dev openssl-dev
pip install \
docker-compose awscli
- run:
name: Build
command: |
mkdir images
echo 'export TAG="$CIRCLE_SHA1"' >> images/env.sh
source images/env.sh
docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile .
cd images
docker save isce/isce2:$TAG > isce2.tar
- persist_to_workspace:
root: images
paths:
- "*"
build-periodically:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
python-dev py-pip bash pigz build-base libffi-dev openssl-dev
pip install \
docker-compose awscli
- run:
name: Build
command: |
mkdir images
echo 'export TAG=$(date -u +%Y%m%d)' >> images/env.sh
source images/env.sh
docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile .
cd images
docker save isce/isce2:$TAG > isce2.tar
- persist_to_workspace:
root: images
paths:
- "*"
deploy:
docker:
- image: alpine:latest
steps:
- run:
name: Install dependencies
command: |
apk add --no-cache \
curl file
- attach_workspace:
at: images
- run:
name: Deploy
command: |
cd images
source env.sh
docker load -i isce2.tar
docker tag isce/isce2:$TAG isce/isce2:latest
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push isce/isce2:$TAG
docker push isce/isce2:latest
workflows:
version: 2
test:
jobs:
- test
build-deploy:
jobs:
- build:
filters:
branches:
only: master
- deploy:
requires:
- build
filters:
branches:
only: master
weekly:
triggers:
- schedule:
cron: "0 7 * * 0"
filters:
branches:
only:
- master
jobs:
- build-periodically:
filters:
branches:
only: master
- deploy:
requires:
- build-periodically
filters:
branches:
only: master