-
Notifications
You must be signed in to change notification settings - Fork 89
112 lines (99 loc) · 4.41 KB
/
build_push_php.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
on:
schedule:
- cron: '0 0 * * 0,3'
push:
branches:
- 'master'
name: "Build And Push PHP Docker Images"
jobs:
build-and-push-docker:
name: "Build And Push PHP Docker Images"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
php-target:
- "cli"
- "fpm"
- "zts"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Install Docker Composer 2.x"
run: |
curl -fL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh | sudo sh
sudo update-alternatives --display docker-compose
docker -v
docker-compose -v
- name: "Build ${{ matrix.php-target }} ${{ matrix.php-version }}"
working-directory: php
env:
PHP_VERSION: ${{ matrix.php-version }}
PHP_TARGET: ${{ matrix.php-target }}
DOCKER_REGISTRY: "ghcr.io/prooph/docker-files/"
run: docker-compose build
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Push PHP images to ghcr.io"
working-directory: php
env:
PHP_VERSION: ${{ matrix.php-version }}
PHP_TARGET: ${{ matrix.php-target }}
DOCKER_REGISTRY: "ghcr.io/prooph/docker-files/"
run: "docker-compose push"
- name: "Push Composer images to ghcr.io"
working-directory: php
env:
PHP_VERSION: ${{ matrix.php-version }}
PHP_TARGET: ${{ matrix.php-target }}
DOCKER_REGISTRY: "ghcr.io/prooph/docker-files/"
if: matrix.php-target == 'cli' || matrix.php-target == 'zts'
run: |
docker tag ${DOCKER_REGISTRY}composer:${PHP_VERSION}-${PHP_TARGET} ${DOCKER_REGISTRY}composer:${PHP_VERSION}
docker push ${DOCKER_REGISTRY}composer:${PHP_VERSION}
docker tag ${DOCKER_REGISTRY}composer:${PHP_VERSION}-${PHP_TARGET}-1x ${DOCKER_REGISTRY}composer:${PHP_VERSION}-1x
docker push ${DOCKER_REGISTRY}composer:${PHP_VERSION}-1x
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Push PHP images to Docker HUB"
working-directory: php
env:
PHP_VERSION: ${{ matrix.php-version }}
PHP_TARGET: ${{ matrix.php-target }}
DOCKER_REGISTRY: "ghcr.io/prooph/docker-files/"
DOCKER_HUB_REGISTRY: "prooph/"
run: |
docker tag ${DOCKER_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET} ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}
docker push ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}
docker tag ${DOCKER_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-blackfire ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-blackfire
docker push ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-blackfire
docker tag ${DOCKER_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-opcache ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-opcache
docker push ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-opcache
docker tag ${DOCKER_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-xdebug ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-xdebug
docker push ${DOCKER_HUB_REGISTRY}php:${PHP_VERSION}-${PHP_TARGET}-xdebug
- name: "Push Composer images to Docker HUB"
working-directory: php
env:
PHP_VERSION: ${{ matrix.php-version }}
PHP_TARGET: ${{ matrix.php-target }}
DOCKER_REGISTRY: "ghcr.io/prooph/docker-files/"
DOCKER_HUB_REGISTRY: "prooph/"
if: matrix.php-target == 'cli' || matrix.php-target == 'zts'
run: |
docker tag ${DOCKER_REGISTRY}composer:${PHP_VERSION}-${PHP_TARGET} ${DOCKER_HUB_REGISTRY}composer:${PHP_VERSION}
docker push ${DOCKER_HUB_REGISTRY}composer:${PHP_VERSION}
docker tag ${DOCKER_REGISTRY}composer:${PHP_VERSION}-${PHP_TARGET}-1x ${DOCKER_HUB_REGISTRY}composer:${PHP_VERSION}-1x
docker push ${DOCKER_HUB_REGISTRY}composer:${PHP_VERSION}-1x