Skip to content

Commit bb0f76b

Browse files
committed
Expand image labels
Add the successor of the label.org labels opencontainer.org to the images
1 parent a532330 commit bb0f76b

3 files changed

Lines changed: 46 additions & 13 deletions

File tree

Dockerfile-nts-alpine

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22
ARG PHP_VERSION=7.4
33
ARG OS_VERSION=alpine3.11
44
FROM php:$PHP_VERSION-cli-$OS_VERSION AS base
5+
ARG ARCH=amd64
6+
ARG PHP_VERSION=7.4
7+
ARG OS_VERSION=alpine3.11
8+
ENV PHP_VERSION=$PHP_VERSION
9+
ENV OS_VERSION=$OS_VERSION
510

6-
# Build-time metadata as defined at http://label-schema.org
7-
LABEL org.label-schema.name="wyrihaximusnet/php" \
8-
org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
11+
# Build-time metadata as defined at http://label-schema.org and https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
12+
LABEL org.label-schema.title="Opinionated ReactPHP optimised PHP Docker images" \
13+
org.label-schema.description="PHP Version: $PHP_VERSION Type: zts OS Version: $OS_VERSION" \
914
org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
1015
org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
1116
org.label-schema.vendor="WyriHaximus.net" \
12-
org.label-schema.schema-version="1.0"
13-
14-
ARG ARCH=amd64
17+
org.label-schema.schema-version="1.0" \
18+
org.opencontainers.image.source="https://github.com/wyrihaximusnet/docker-php" \
19+
org.opencontainers.image.url="https://github.com/wyrihaximusnet/docker-php" \
20+
org.opencontainers.image.documentation="https://github.com/wyrihaximusnet/docker-php" \
21+
org.opencontainers.image.title="Opinionated ReactPHP optimised PHP Docker images" \
22+
org.opencontainers.image.description="PHP Version: $PHP_VERSION Type: zts OS Version: $OS_VERSION" \
23+
org.opencontainers.image.licenses="MIT" \
24+
org.opencontainers.image.base.name="php:$PHP_VERSION-cli-$OS_VERSION" \
25+
org.opencontainers.image.vendor="WyriHaximus.net"
1526

1627
RUN apk update \
1728
&& apk upgrade \

Dockerfile-zts-alpine

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22
ARG PHP_VERSION=7.4
33
ARG OS_VERSION=alpine3.11
44
FROM php:$PHP_VERSION-zts-$OS_VERSION AS base
5+
ARG ARCH=amd64
6+
ARG PHP_VERSION=7.4
7+
ARG OS_VERSION=alpine3.11
8+
ENV PHP_VERSION=$PHP_VERSION
9+
ENV OS_VERSION=$OS_VERSION
510

6-
# Build-time metadata as defined at http://label-schema.org
7-
LABEL org.label-schema.name="wyrihaximusnet/php" \
8-
org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
11+
# Build-time metadata as defined at http://label-schema.org and https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
12+
LABEL org.label-schema.title="Opinionated ReactPHP optimised PHP Docker images" \
13+
org.label-schema.description="PHP Version: $PHP_VERSION Type: zts OS Version: $OS_VERSION" \
914
org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
1015
org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
1116
org.label-schema.vendor="WyriHaximus.net" \
12-
org.label-schema.schema-version="1.0"
13-
14-
ARG ARCH=amd64
17+
org.label-schema.schema-version="1.0" \
18+
org.opencontainers.image.source="https://github.com/wyrihaximusnet/docker-php" \
19+
org.opencontainers.image.url="https://github.com/wyrihaximusnet/docker-php" \
20+
org.opencontainers.image.documentation="https://github.com/wyrihaximusnet/docker-php" \
21+
org.opencontainers.image.title="Opinionated ReactPHP optimised PHP Docker images" \
22+
org.opencontainers.image.description="PHP Version: $PHP_VERSION Type: zts OS Version: $OS_VERSION" \
23+
org.opencontainers.image.licenses="MIT" \
24+
org.opencontainers.image.base.name="php:$PHP_VERSION-zts-$OS_VERSION" \
25+
org.opencontainers.image.vendor="WyriHaximus.net"
1526

1627
RUN apk update \
1728
&& apk upgrade \

build-php.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ docker pull "php:${IMAGE_TAG}"
4545

4646
for buildTarget in "${target[@]}"
4747
do
48-
docker build --build-arg ARCH=${TARGET_ARCH} --build-arg PHP_VERSION=${VERSION_PHP} --build-arg OS_VERSION=${VERSION_OS} --platform ${TARGET_ARCH} --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG}${buildTarget}-${TARGET_ARCH}" --target="${DST_IMAGE}${buildTarget}" -f "Dockerfile-${DST_IMAGE}-${OS}" .
48+
docker build --no-cache \
49+
--build-arg ARCH=${TARGET_ARCH} \
50+
--build-arg PHP_VERSION=${VERSION_PHP} \
51+
--build-arg OS_VERSION=${VERSION_OS} \
52+
--platform ${TARGET_ARCH} \
53+
--label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
54+
--label org.opencontainers.image.created=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
55+
--label org.label-schema.vcs-ref=`git rev-parse --short HEAD` \
56+
--label org.opencontainers.image.revision-ref=`git rev-parse --short HEAD` \
57+
-t "${WYRIHAXIMUSNET_TAG}${buildTarget}-${TARGET_ARCH}" \
58+
--target="${DST_IMAGE}${buildTarget}" \
59+
-f "Dockerfile-${DST_IMAGE}-${OS}" .
4960
echo "${WYRIHAXIMUSNET_TAG}${buildTarget}-${TARGET_ARCH}" >> "$TAG_FILE"
5061
done

0 commit comments

Comments
 (0)