Skip to content

Commit

Permalink
Add Docker Hub build hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Jan 25, 2019
1 parent 93289b4 commit 01ce5c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Docker Hub Automated Build Hooks

This directory contains Docker Hub [Automated Build](https://docs.docker.com/docker-hub/builds/advanced/) hooks.
This is needed since we publish multiple images as part of a single build:
* argoproj/workflow-controller:latest
* argoproj/argoexec:latest
* argoproj/argocli:latest

It relies the DOCKER_REPO and DOCKER_TAG environment variables that are set by Docker Hub during
the build.

Hooks can be tested using:
```
DOCKER_REPO=index.docker.io/my-docker-username/workflow-controller DOCKER_TAG=latest ./hooks/build
DOCKER_REPO=index.docker.io/my-docker-username/workflow-controller DOCKER_TAG=latest ./hooks/push
```
7 changes: 7 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e
docker_org=$(echo $DOCKER_REPO | rev | cut -d / -f 2- | rev)
targets="workflow-controller argoexec argocli"
for target in $targets; do
image_name="${docker_org}/${target}:${DOCKER_TAG}"
docker build --target $target -t $image_name .
done
7 changes: 7 additions & 0 deletions hooks/push
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e
docker_org=$(echo $DOCKER_REPO | rev | cut -d / -f 2- | rev)
targets="workflow-controller argoexec argocli"
for target in $targets; do
image_name="${docker_org}/${target}:${DOCKER_TAG}"
docker push $image_name
done

0 comments on commit 01ce5c3

Please sign in to comment.