-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 3.6 KB
/
docker.build.composer-2.yaml
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
name: Build Composer 2 Docker images
on:
workflow_dispatch:
repository_dispatch:
types: [php-images-built]
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ "8.1", "8.2", "8.3" ]
user: [ "composer", "root" ]
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 100
- name: Determine latest released version
id: latest_version
uses: flownative/action-git-latest-release@v1
- run: |
sudo chmod -R ugo+rwX . && shopt -s dotglob && rm -rf *
- uses: actions/checkout@v4
with:
ref: ${{ steps.latest_version.outputs.tag }}
fetch-depth: 100
- name: Determine latest built PHP ${{ matrix.php }} version
id: latest_php_version
uses: flownative/action-docker-get-label@master
with:
image: europe-docker.pkg.dev/flownative/docker/php:${{ matrix.php }}
label: org.opencontainers.image.version
registry_endpoint: https://europe-docker.pkg.dev
registry_username: '_json_key'
registry_password: ${{ secrets.GOOGLE_ARTIFACTS_PASSWORD_DOCKER }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
images: |
${{ matrix.user == 'root' && 'flownative/composer2-root' || 'flownative/composer2' }}
${{ matrix.user == 'root' && 'europe-docker.pkg.dev/flownative/docker/composer2-root' || 'europe-docker.pkg.dev/flownative/docker/composer2' }}
labels: |
org.opencontainers.image.title=Composer
org.opencontainers.image.description=Docker image providing Composer 2 for Beach and Local Beach
org.opencontainers.image.licenses=MIT
org.opencontainers.image.vendor=Flownative GmbH
org.opencontainers.image.authors=Robert Lemke <[email protected]>
org.opencontainers.image.version=${{ steps.latest_php_version.outputs.value }}
tags: |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.latest_php_version.outputs.value }}
type=semver,pattern={{version}},value=${{ steps.latest_php_version.outputs.value }}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_IO_REGISTRY_USER }}
password: ${{ secrets.DOCKER_IO_REGISTRY_PASSWORD }}
- name: Login to Google Artifacts Registry
uses: docker/login-action@v3
with:
registry: europe-docker.pkg.dev/flownative/docker
username: '_json_key'
password: ${{ secrets.GOOGLE_ARTIFACTS_PASSWORD_DOCKER }}
- name: Add COPY statement for Composer
run: |
echo "COPY --from=composer:2 /usr/bin/composer /usr/bin/composer" >> Dockerfile
- name: Add USER statement
run: |
echo "USER ${{ matrix.user }}" >> Dockerfile
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
PHP_BASE_IMAGE=europe-docker.pkg.dev/flownative/docker/php:${{ steps.latest_php_version.outputs.value }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}