Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use reusable workflows to test PRs without pushing to the registry #32

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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