From f260523ad53e8becae62fbae7a970c9d3b19abc5 Mon Sep 17 00:00:00 2001 From: Jose Carlos Date: Sun, 22 Feb 2026 09:30:28 +0100 Subject: [PATCH] feat: add OCI image labels to all Dockerfiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the bare 'maintainer' LABEL with standard org.opencontainers.image.* labels across all four PHP versions (8.1, 8.2, 8.3, 8.4). Labels added: authors — Jorge Arco source — https://github.com/jorge07/alpine-php title — jorge07/alpine-php description — Lightweight PHP-FPM Docker images based on Alpine Linux licenses — Apache-2.0 url — https://hub.docker.com/r/jorge07/alpine-php created — populated via BUILD_DATE ARG at build time revision — populated via VCS_REF ARG at build time Makefile updated: OCI_LABELS variable computes BUILD_DATE and VCS_REF from current date/git SHA and passes them as --build-arg to all build and release targets. Build-tested locally (8.3): all 8 labels confirmed in docker inspect. Closes #101 (OCI labels item) --- 8.1/Dockerfile | 12 +++++++++++- 8.2/Dockerfile | 12 +++++++++++- 8.3/Dockerfile | 12 +++++++++++- 8.4/Dockerfile | 12 +++++++++++- makefile | 15 +++++++++------ 5 files changed, 53 insertions(+), 10 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 4344e40..8f4d3da 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -1,6 +1,16 @@ FROM --platform=$BUILDPLATFORM alpine:3.19 AS main -LABEL maintainer="Jorge Arco " +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.opencontainers.image.authors="Jorge Arco " \ + org.opencontainers.image.source="https://github.com/jorge07/alpine-php" \ + org.opencontainers.image.title="jorge07/alpine-php" \ + org.opencontainers.image.description="Lightweight PHP-FPM Docker images based on Alpine Linux" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.url="https://hub.docker.com/r/jorge07/alpine-php" \ + org.opencontainers.image.created="${BUILD_DATE}" \ + org.opencontainers.image.revision="${VCS_REF}" RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main add \ icu-libs \ diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 942929a..3f03b52 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -1,6 +1,16 @@ FROM --platform=$BUILDPLATFORM alpine:3.21 AS main -LABEL maintainer="Jorge Arco " +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.opencontainers.image.authors="Jorge Arco " \ + org.opencontainers.image.source="https://github.com/jorge07/alpine-php" \ + org.opencontainers.image.title="jorge07/alpine-php" \ + org.opencontainers.image.description="Lightweight PHP-FPM Docker images based on Alpine Linux" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.url="https://hub.docker.com/r/jorge07/alpine-php" \ + org.opencontainers.image.created="${BUILD_DATE}" \ + org.opencontainers.image.revision="${VCS_REF}" RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.21/main add \ icu-libs \ diff --git a/8.3/Dockerfile b/8.3/Dockerfile index e27bdb2..bccae3e 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -1,6 +1,16 @@ FROM --platform=$BUILDPLATFORM alpine:3.20 AS main -LABEL maintainer="Jorge Arco " +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.opencontainers.image.authors="Jorge Arco " \ + org.opencontainers.image.source="https://github.com/jorge07/alpine-php" \ + org.opencontainers.image.title="jorge07/alpine-php" \ + org.opencontainers.image.description="Lightweight PHP-FPM Docker images based on Alpine Linux" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.url="https://hub.docker.com/r/jorge07/alpine-php" \ + org.opencontainers.image.created="${BUILD_DATE}" \ + org.opencontainers.image.revision="${VCS_REF}" RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.20/main add \ icu-libs \ diff --git a/8.4/Dockerfile b/8.4/Dockerfile index e2191f5..53e35a5 100644 --- a/8.4/Dockerfile +++ b/8.4/Dockerfile @@ -2,7 +2,17 @@ # TODO: pin to alpine:3.22 (or next stable) once available. FROM --platform=$BUILDPLATFORM alpine:edge AS main -LABEL maintainer="Jorge Arco " +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.opencontainers.image.authors="Jorge Arco " \ + org.opencontainers.image.source="https://github.com/jorge07/alpine-php" \ + org.opencontainers.image.title="jorge07/alpine-php" \ + org.opencontainers.image.description="Lightweight PHP-FPM Docker images based on Alpine Linux" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.url="https://hub.docker.com/r/jorge07/alpine-php" \ + org.opencontainers.image.created="${BUILD_DATE}" \ + org.opencontainers.image.revision="${VCS_REF}" RUN apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/main add \ icu-libs \ diff --git a/makefile b/makefile index 0242892..680b6fe 100644 --- a/makefile +++ b/makefile @@ -2,10 +2,13 @@ REPO:=jorge07/alpine-php DOCKER_RUN:=docker run --rm -v $(PWD):/app ${REPO}:${VERSION} DOCKER_RUN_DEV:=$(DOCKER_RUN)-dev ARCHS?=linux/amd64 +BUILD_DATE?=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') +VCS_REF?=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") +OCI_LABELS=--build-arg BUILD_DATE=$(BUILD_DATE) --build-arg VCS_REF=$(VCS_REF) build: - docker buildx build --load --platform linux/amd64 -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/ - docker buildx build --load --platform linux/amd64 -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --load --platform linux/amd64 $(OCI_LABELS) -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --load --platform linux/amd64 $(OCI_LABELS) -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ run-detached: docker run --name php${VERSION} -d -v $(PWD):/app $(REPO):${VERSION} @@ -30,10 +33,10 @@ release: build echo "Releasing: ${REPO}:${VERSION}" echo "Releasing: ${REPO}:${VERSION}-dev" $(eval export SEMVER=$(shell docker run --rm -v $(PWD):/app ${REPO}:${VERSION} php -r "echo phpversion();")) - docker buildx build --platform $(ARCHS) --push -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/ - docker buildx build --platform $(ARCHS) --push -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ - docker buildx build --platform $(ARCHS) --push -t $(REPO):${SEMVER} --target main -f ${VERSION}/Dockerfile ${VERSION}/ - docker buildx build --platform $(ARCHS) --push -t $(REPO):${SEMVER}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --platform $(ARCHS) --push $(OCI_LABELS) -t $(REPO):${VERSION} --target main -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --platform $(ARCHS) --push $(OCI_LABELS) -t $(REPO):${VERSION}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --platform $(ARCHS) --push $(OCI_LABELS) -t $(REPO):${SEMVER} --target main -f ${VERSION}/Dockerfile ${VERSION}/ + docker buildx build --platform $(ARCHS) --push $(OCI_LABELS) -t $(REPO):${SEMVER}-dev --target dev -f ${VERSION}/Dockerfile ${VERSION}/ test-all: VERSION=8.3 $(MAKE) build