Repository navigation
135 lines (120 loc) · 4.69 KB
/
Copy pathdocker.build.yaml
File metadata and controls
135 lines (120 loc) · 4.69 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build Docker images
on:
repository_dispatch:
types: [php-images-built]
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ "8.2", "8.3", "8.4", "8.5" ]
steps:
- uses: actions/checkout@v7
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@v7
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@v1
with:
image: harbor.flownative.io/docker/php:${{ matrix.php }}
label: org.opencontainers.image.version
registry_endpoint: https://harbor.flownative.io
registry_username: ${{ secrets.HARBOR_DOCKER_USERNAME }}
registry_password: ${{ secrets.HARBOR_DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
flavor: |
latest=false
images: |
flownative/beach-php
harbor.flownative.io/docker/beach-php
labels: |
org.opencontainers.image.title=Beach PHP
org.opencontainers.image.description=Docker image providing PHP for Beach and Local Beach
org.opencontainers.image.licenses=MIT
org.opencontainers.image.vendor=Flownative GmbH
org.opencontainers.image.authors=Robert Lemke <robert@flownative.com>
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@v4
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_IO_REGISTRY_USER }}
password: ${{ secrets.DOCKER_IO_REGISTRY_PASSWORD }}
- name: Login to Harbor
uses: docker/login-action@v4
with:
registry: harbor.flownative.io
username: ${{ secrets.HARBOR_DOCKER_USERNAME }}
password: ${{ secrets.HARBOR_DOCKER_PASSWORD }}
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
PHP_BASE_IMAGE=harbor.flownative.io/docker/php:${{ steps.latest_php_version.outputs.value }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
announce:
runs-on: ubuntu-latest
needs: build
steps:
- name: Dispatch to beach-php-k8s
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.FLOWNATIVE_BOT_TOKEN }}
repository: flownative/docker-beach-php-k8s
event-type: beach-php-images-built
client-payload: '{"image_name": "flownative/docker-php/beach-php"}'
- name: Dispatch to versions.flownative.io
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.FLOWNATIVE_BOT_TOKEN }}
repository: flownative/versions.flownative.io
event-type: beach-php-images-built
client-payload: '{"image_name": "flownative/docker-php/beach-php"}'
- name: Push heartbeat metric to Grafana Cloud
if: success()
env:
RW_URL: ${{ secrets.GRAFANA_METRICS_RW_URL }}
INSTANCE_ID: ${{ secrets.GRAFANA_METRICS_INSTANCE_ID }}
TOKEN: ${{ secrets.GRAFANA_METRICS_PUSH_TOKEN }}
run: |
set -euo pipefail
# Derive the Influx line-protocol push endpoint from the Prometheus
# remote-write endpoint (same account, different host/path).
INFLUX_URL="$(printf '%s' "$RW_URL" | sed -e 's#prometheus-#influx-#' -e 's#/api/prom/push#/api/v1/push/influx/write#')"
NOW="$(date +%s)"
curl -sf --retry 3 --retry-all-errors \
-u "${INSTANCE_ID}:${TOKEN}" \
-H 'Content-Type: text/plain' \
"${INFLUX_URL}" \
--data-binary "flownative_ci_last_success_timestamp,job=docker-build,image=beach-php seconds=${NOW}"