Last active
June 9, 2020 02:37
-
-
Save atton/ca0a242f60fd4e65bb0b315454e73e93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original: https://github.com/atton/dockerfiles/blob/1566be5489c34ba743dd5735f6584d3ef213cdb5/.github/workflows/build-and-push.yml | |
name: Build and Push Docker Images | |
on: push | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
run: git clone https://github.com/atton/dockerfiles | |
- name: Build and Push Docker Images | |
run: sh dockerfiles/build.sh ${{ secrets.DOCKER_PASSWORD }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original: https://github.com/atton/dockerfiles/blob/1566be5489c34ba743dd5735f6584d3ef213cdb5/build.sh | |
#!/bin/sh | |
cd `dirname $0` | |
git show --name-only | |
if [ -n "$1" ]; then docker login -u atton -p $1; fi | |
for name in `ls`; do | |
if [ ! -d $name ]; then continue; fi | |
if [ ! -f $name/Dockerfile ]; then continue; fi | |
tag="atton/$name" | |
docker build --compress --pull -t $tag $name | |
git diff-tree --no-commit-id --name-only -r master | grep "$name/" >/dev/null 2>&1 | |
if [ $? -eq 0 ]; then docker push $tag; fi | |
done | |
if [ -n "$1" ]; then docker logout; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment