Skip to content

Commit 234dbd0

Browse files
committed
Add GitHub Actions workflow for building and pushing Docker images
1 parent 084fa2d commit 234dbd0

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
# Allow manual triggering
9+
workflow_dispatch:
10+
# Run once a month to keep images updated with latest security patches
11+
schedule:
12+
- cron: '0 0 1 * *'
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v2
24+
25+
- name: Login to DockerHub
26+
uses: docker/login-action@v2
27+
with:
28+
username: ${{ secrets.DOCKERHUB_USERNAME }}
29+
password: ${{ secrets.DOCKERHUB_TOKEN }}
30+
31+
# The PHP 7.x versions are commented out as they are legacy and should just remain as is.
32+
# - name: Build and push PHP 7.0
33+
# uses: docker/build-push-action@v4
34+
# with:
35+
# context: .
36+
# push: true
37+
# build-args: |
38+
# PHP_VERSION=php7.0-apache
39+
# tags: pattonwebz/local-wordpress-with-xdebug:php7.0-apache
40+
#
41+
# - name: Build and push PHP 7.1
42+
# uses: docker/build-push-action@v4
43+
# with:
44+
# context: .
45+
# push: true
46+
# build-args: |
47+
# PHP_VERSION=php7.1-apache
48+
# tags: pattonwebz/local-wordpress-with-xdebug:php7.1-apache
49+
#
50+
# - name: Build and push PHP 7.2
51+
# uses: docker/build-push-action@v4
52+
# with:
53+
# context: .
54+
# push: true
55+
# build-args: |
56+
# PHP_VERSION=php7.2-apache
57+
# tags: pattonwebz/local-wordpress-with-xdebug:php7.2-apache
58+
#
59+
# - name: Build and push PHP 7.4
60+
# uses: docker/build-push-action@v4
61+
# with:
62+
# context: .
63+
# push: true
64+
# build-args: |
65+
# PHP_VERSION=php7.4-apache
66+
# tags: pattonwebz/local-wordpress-with-xdebug:php7.4-apache
67+
68+
- name: Build and push PHP 8.0
69+
uses: docker/build-push-action@v4
70+
with:
71+
context: .
72+
push: true
73+
build-args: |
74+
PHP_VERSION=php8.0-apache
75+
tags: pattonwebz/local-wordpress-with-xdebug:php8.0-apache
76+
77+
- name: Build and push PHP 8.1
78+
uses: docker/build-push-action@v4
79+
with:
80+
context: .
81+
push: true
82+
build-args: |
83+
PHP_VERSION=php8.1-apache
84+
tags: pattonwebz/local-wordpress-with-xdebug:php8.1-apache
85+
86+
- name: Build and push PHP 8.2
87+
uses: docker/build-push-action@v4
88+
with:
89+
context: .
90+
push: true
91+
build-args: |
92+
PHP_VERSION=php8.2-apache
93+
tags: |
94+
pattonwebz/local-wordpress-with-xdebug:php8.2-apache
95+
pattonwebz/local-wordpress-with-xdebug:latest
96+
97+
- name: Build and push PHP 8.3
98+
uses: docker/build-push-action@v4
99+
with:
100+
context: .
101+
push: true
102+
build-args: |
103+
PHP_VERSION=php8.3-apache
104+
tags: pattonwebz/local-wordpress-with-xdebug:php8.3-apache
105+
106+
- name: Build and push PHP 8.4
107+
uses: docker/build-push-action@v4
108+
with:
109+
context: .
110+
push: true
111+
build-args: |
112+
PHP_VERSION=php8.4-apache
113+
tags: pattonwebz/local-wordpress-with-xdebug:php8.4-apache

0 commit comments

Comments
 (0)