Skip to content

Commit

Permalink
use reusable workflows to test PRs without pushing to the registry
Browse files Browse the repository at this point in the history
  • Loading branch information
chasebolt committed Nov 3, 2024
1 parent 4bbdd1c commit 9f58874
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 37 deletions.
80 changes: 43 additions & 37 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Build Docker Image

on:
push:
branches:
- "master"
workflow_call:
inputs:
push_images:
default: false
type: boolean
secrets:
dockerhub_username:
dockerhub_token:

jobs:
docker:
Expand All @@ -18,109 +23,110 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build And Push 7.1-alpine
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}
if: github.ref_name == github.event.repository.default_branch
- name: Build 7.1-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/7.1/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.1-alpine
- name: Build And Push 7.2-alpine
- name: Build 7.2-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/7.2/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.2-alpine
- name: Build And Push 7.3-alpine
- name: Build 7.3-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/7.3/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.3-alpine
- name: Build And Push 7.4-alpine
- name: Build 7.4-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/7.4/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.4-alpine
- name: Build And Push 8.0-alpine
- name: Build 8.0-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/8.0/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.0-alpine
- name: Build And Push 8.1-alpine
- name: Build 8.1-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/8.1/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.1-alpine
- name: Build And Push 8.2-alpine
- name: Build 8.2-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/8.2/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.2-alpine
- name: Build And Push 8.3-alpine
- name: Build 8.3-alpine
uses: docker/build-push-action@v2
with:
context: .
file: ./images/8.3/Dockerfile-alpine
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.3-alpine,umutphp/php-docker-images-for-ci:latest-alpine
- name: Build And Push 7.1
- name: Build 7.1
uses: docker/build-push-action@v2
with:
context: ./images/7.1/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.1
- name: Build And Push 7.2
- name: Build 7.2
uses: docker/build-push-action@v2
with:
context: ./images/7.2/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.2
- name: Build And Push 7.3
- name: Build 7.3
uses: docker/build-push-action@v2
with:
context: ./images/7.3/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.3
- name: Build And Push 7.4
- name: Build 7.4
uses: docker/build-push-action@v2
with:
context: ./images/7.4/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:7.4
- name: Build And Push 8.0
- name: Build 8.0
uses: docker/build-push-action@v2
with:
context: ./images/8.0/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.0
- name: Build And Push 8.1
- name: Build 8.1
uses: docker/build-push-action@v2
with:
context: ./images/8.1/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.1
- name: Build And Push 8.2
- name: Build 8.2
uses: docker/build-push-action@v2
with:
context: ./images/8.2/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.2
- name: Build And Push 8.3
- name: Build 8.3
uses: docker/build-push-action@v2
with:
context: ./images/8.3/
push: true
push: ${{ inputs.push_images }}
tags: umutphp/php-docker-images-for-ci:8.3,umutphp/php-docker-images-for-ci:latest
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build & Push Docker Images

on:
push:
branches:
- main

jobs:
build-push-images:
uses: ./.github/workflows/build-docker-image.yml
with:
push_images: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Build Docker Images

on:
pull_request:

jobs:
build-images:
uses: ./.github/workflows/build-docker-image.yml

0 comments on commit 9f58874

Please sign in to comment.