1+ name : ' build docker images: Alpine + 8.4 PHP-FPM + NGINX'
2+
3+ on :
4+ # push:
5+ # branches:
6+ # - 'main'
7+ # - 'master'
8+ # paths:
9+ # - 'alpine.fpm_nginx.slim.Dockerfile'
10+ # - 'alpine.fpm_nginx.Dockerfile'
11+ # - 'alpine.fpm_nginx.extended.Dockerfile'
12+ # - '.github/workflows/build_docker_images-php8_4-alpine_fpm_nginx.yaml'
13+ workflow_dispatch :
14+ schedule :
15+ - cron : ' 45 5 24 * *' # At 05:45 on day-of-month 24.
16+
17+ defaults :
18+ run :
19+ shell : bash
20+
21+ jobs :
22+ docker :
23+ runs-on : ubuntu-latest
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v2
27+
28+ - name : Shell-Script
29+ id : script
30+ run : |
31+ BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
32+ BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
33+ COMMIT_HASH=${GITHUB_SHA::8}
34+ GITHUB_REPO=${GITHUB_REPOSITORY,,}
35+ GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
36+ GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
37+ DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
38+ REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
39+
40+ PHP_VERSION="8.4"
41+
42+ # Set output parameters to github action.
43+ echo ::set-output name=build_date::${BUILD_DATE}
44+ echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
45+ echo ::set-output name=commit_hash::${COMMIT_HASH}
46+ echo ::set-output name=github_repo::${GITHUB_REPO}
47+ echo ::set-output name=docker_repo::${DOCKER_REPO}
48+ echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
49+
50+ echo ::set-output name=php_version::${PHP_VERSION}
51+
52+ - name : Set up QEMU
53+ id : qemu
54+ uses : docker/setup-qemu-action@v1
55+ with :
56+ image : tonistiigi/binfmt:latest
57+ platforms : all
58+
59+ - name : Set up Docker Buildx
60+ id : buildx
61+ uses : docker/setup-buildx-action@master
62+
63+ # - name: Login to GitHub Container Registry
64+ # uses: docker/login-action@v1
65+ # with:
66+ # registry: ghcr.io
67+ # username: ${{ github.repository_owner }}
68+ # password: ${{ secrets.GITHUB_TOKEN }}
69+
70+ - name : Login to DockerHub
71+ uses : docker/login-action@v1
72+ with :
73+ registry : docker.io
74+ username : ${{ secrets.DOCKER_USERNAME }}
75+ password : ${{ secrets.DOCKER_PASSWORD }}
76+
77+ # - name: Login to RED HAT Quay.io Container Registry
78+ # uses: docker/login-action@v1
79+ # with:
80+ # registry: quay.io
81+ # username: ${{ secrets.REDHAT_QUAY_USERNAME }}
82+ # password: ${{ secrets.REDHAT_QUAY_PASSWORD }}
83+
84+ - name : Build-slim
85+ uses : docker/build-push-action@v2
86+ with :
87+ builder : ${{ steps.buildx.outputs.name }}
88+ context : .
89+ file : ./alpine.fpm_nginx.slim.Dockerfile
90+ platforms : linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6
91+ pull : true
92+ push : true
93+ build-args : |
94+ BUILD_DATE=${{steps.script.outputs.build_date}}
95+ VCS_REF=${{steps.script.outputs.commit_hash}}
96+ PHP_VERSION=${{steps.script.outputs.php_version}}
97+ tags : |
98+ docker.io/${{steps.script.outputs.docker_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-slim
99+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-slim-${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
100+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-slim
101+ # quay.io/${{steps.script.outputs.redhat_quay_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-slim
102+
103+ - name : Build
104+ uses : docker/build-push-action@v2
105+ with :
106+ builder : ${{ steps.buildx.outputs.name }}
107+ context : .
108+ file : ./alpine.fpm_nginx.Dockerfile
109+ platforms : linux/amd64,linux/arm64/v8,linux/arm/v7
110+ pull : true
111+ push : true
112+ build-args : |
113+ BUILD_DATE=${{steps.script.outputs.build_date}}
114+ VCS_REF=${{steps.script.outputs.commit_hash}}
115+ PHP_VERSION=${{steps.script.outputs.php_version}}
116+ tags : |
117+ docker.io/${{steps.script.outputs.docker_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine
118+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
119+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine
120+ # quay.io/${{steps.script.outputs.redhat_quay_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine
121+
122+ - name : Build-extended
123+ uses : docker/build-push-action@v2
124+ with :
125+ builder : ${{ steps.buildx.outputs.name }}
126+ context : .
127+ file : ./alpine.fpm_nginx.extended.Dockerfile
128+ platforms : linux/amd64,linux/arm64/v8,linux/arm/v7
129+ pull : true
130+ push : true
131+ build-args : |
132+ BUILD_DATE=${{steps.script.outputs.build_date}}
133+ VCS_REF=${{steps.script.outputs.commit_hash}}
134+ PHP_VERSION=${{steps.script.outputs.php_version}}
135+ tags : |
136+ docker.io/${{steps.script.outputs.docker_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-extended
137+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-extended-${{steps.script.outputs.build_date_numeric}}.${{steps.script.outputs.commit_hash}}
138+ # ghcr.io/${{steps.script.outputs.github_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-extended
139+ # quay.io/${{steps.script.outputs.redhat_quay_repo}}:${{steps.script.outputs.php_version}}-fpm-nginx-alpine-extended
140+
141+ - name : Docker Hub Description
142+ uses : peter-evans/dockerhub-description@v3
143+ with :
144+ username : ${{ secrets.DOCKER_USERNAME }}
145+ password : ${{ secrets.DOCKER_PASSWORD }}
146+ repository : ${{steps.script.outputs.docker_repo}}
147+ short-description : ${{ github.event.repository.description }}
148+ readme-filepath : README.md
0 commit comments