Skip to content

Commit 8028f97

Browse files
authored
chore: build images dynamically (#1545)
* chore: build images dynamically * fix: only push on main * chore: build on PR with path change * chore: align casing * fix: add missing 8.0 alias * fix: declare arg before all others
1 parent 5899a9e commit 8028f97

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Diff for: .github/workflows/publish-otel-php-base-docker-image.yml

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
schedule:
44
- cron: "0 0 * * 0"
55
workflow_dispatch:
6+
push:
7+
paths:
8+
- docker/Dockerfile
9+
pull_request:
10+
paths:
11+
- docker/Dockerfile
612
jobs:
713
push_to_registry:
814
name: OpenTelemetry PHP base docker image creation
@@ -30,6 +36,17 @@ jobs:
3036

3137
- name: Build and push ${{ matrix.php-version }} to ghcr.io
3238
uses: docker/build-push-action@v5
39+
if: github.ref != 'refs/heads/main'
40+
with:
41+
push: false
42+
file: docker/Dockerfile
43+
build-args: PHP_VERSION=${{ matrix.php-version }}
44+
platforms: linux/amd64,linux/arm/v8,linux/arm64
45+
tags: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${{ matrix.php-version }}
46+
47+
- name: Build and push ${{ matrix.php-version }} to ghcr.io
48+
uses: docker/build-push-action@v5
49+
if: github.ref == 'refs/heads/main'
3350
with:
3451
push: true
3552
file: docker/Dockerfile

Diff for: docker/Dockerfile

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
ARG PHP_VERSION=8.0
2-
FROM php:${PHP_VERSION}-cli-alpine
2+
3+
FROM php:8.0.30-cli-alpine AS php-8.0-cli-alpine
4+
FROM php:8.1.32-cli-alpine AS php-8.1-cli-alpine
5+
FROM php:8.2.28-cli-alpine AS php-8.2-cli-alpine
6+
FROM php:8.3.19-cli-alpine AS php-8.3-cli-alpine
7+
FROM php:8.4.5-cli-alpine AS php-8.4-cli-alpine
8+
9+
FROM php-${PHP_VERSION}-cli-alpine
310

411
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
512

0 commit comments

Comments
 (0)