Skip to content

Commit f4b297b

Browse files
committed
added workflows
1 parent ba0e824 commit f4b297b

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

.github/workflows/build-image.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Image Build
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
build-image:
7+
name: Build and push Docker image
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v5
12+
with:
13+
ref: ${{ github.event.pull_request.head.sha }}
14+
15+
- name: Docker meta
16+
id: meta
17+
uses: docker/metadata-action@v5
18+
with:
19+
images: |
20+
digiblink/alpine-nginx-php-fpm
21+
ghcr.io/digiblink/alpine-nginx-php-fpm
22+
tags: |
23+
type=sha
24+
type=ref,event=tag
25+
type=raw,value=latest,enable={{is_default_branch}}
26+
flavor: |
27+
latest=auto
28+
prefix=,onlatest=false
29+
suffix=
30+
labels: |
31+
org.opencontainers.image.vendor=digiBlink
32+
org.opencontainers.image.source=https://github.com/${{ env.REPO_NAME }}
33+
org.opencontainers.image.title=Alpine based image with latest PHP 8.4 FPM and Nginx
34+
org.opencontainers.image.description=Alpine based image with latest PHP 8.4 FPM and Nginx
35+
org.opencontainers.image.created=${{ steps.time.outputs.time }}
36+
org.opencontainers.image.revision=${{ steps.short-sha.outputs.sha }}
37+
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Login to Docker Hub
45+
if: github.event_name != 'pull_request'
46+
uses: docker/login-action@v3
47+
with:
48+
username: ${{ vars.DH_USER }}
49+
password: ${{ secrets.DH_PAT }}
50+
51+
- name: Login to GHCR
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Build image and push to GitHub Container Registry
59+
uses: docker/build-push-action@v6
60+
with:
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
65+
- name: Image digest
66+
run: echo ${{ steps.docker_build.outputs.digest }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Trigger on Merge to Main / Tag
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
build-image:
12+
uses: ./.github/workflows/build-image.yaml
13+
secrets: inherit

.github/workflows/trigger-pr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Trigger on PR
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
build-image:
12+
uses: ./.github/workflows/build-image.yaml
13+
secrets: inherit

0 commit comments

Comments
 (0)