Skip to content

Commit 370b548

Browse files
committed
use same labels as Hyperledger-Fabric
Signed-off-by: pco <pasquale.convertini@ibm.com>
1 parent b2442f7 commit 370b548

4 files changed

Lines changed: 33 additions & 13 deletions

File tree

.github/workflows/docker-release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ jobs:
6363
- name: Build cross-architecture binaries
6464
run: make build-arch build-test-genesis-block
6565

66-
- name: Set image prefix
66+
- name: Set image build prefix and metadata
6767
run: |
68+
echo "CREATED=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
69+
echo "REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
6870
if [ "$GITHUB_REPOSITORY_OWNER" == "hyperledger" ]; then
6971
echo "IMAGE_PREFIX=hyperledger" >> $GITHUB_ENV
7072
else
@@ -89,6 +91,8 @@ jobs:
8991
ARCHBIN_PATH=archbin
9092
PORTS=4001 2114 9001 2119 5001 2115 6001 2116 7001 2117
9193
VERSION=${{ env.VERSION }}
94+
CREATED=${{ env.CREATED }}
95+
REVISION=${{ env.REVISION }}
9296
cache-from: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache
9397
cache-to: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache,mode=max
9498

@@ -109,6 +113,8 @@ jobs:
109113
ARCHBIN_PATH=archbin
110114
PORTS=8001 2118
111115
VERSION=${{ env.VERSION }}
116+
CREATED=${{ env.CREATED }}
117+
REVISION=${{ env.REVISION }}
112118
cache-from: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-loadgen:buildcache
113119
cache-to: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-loadgen:buildcache,mode=max
114120

@@ -127,5 +133,7 @@ jobs:
127133
build-args: |
128134
ARCHBIN_PATH=archbin
129135
VERSION=${{ env.VERSION }}
136+
CREATED=${{ env.CREATED }}
137+
REVISION=${{ env.REVISION }}
130138
cache-from: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer-test-node:buildcache
131139
cache-to: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer-test-node:buildcache,mode=max

docker/images/release/Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ ARG ARCHBIN_PATH
1414
ARG TARGETOS
1515
ARG TARGETARCH
1616
ARG PORTS
17+
18+
# Label args
1719
ARG VERSION=1.0
20+
ARG CREATED
21+
ARG REVISION=1.0
1822

1923
# Add non-root user (10001) using BIN argument
2024
RUN /usr/sbin/useradd -u 10001 -r -g root -s /sbin/nologin -c "Hyperledger Fabric-X ${BIN} user" ${BIN} && \
@@ -33,12 +37,15 @@ RUN ln -s /bin/${BIN} /bin/entrypoint
3337
EXPOSE ${PORTS}
3438

3539
# OCI metadata labels
36-
LABEL name="${BIN}" \
37-
maintainer="IBM Research ZRL Decentralized Trust Group" \
38-
version="${VERSION}" \
39-
description="Hyperledger Fabric-X ${BIN} packaged in a UBI image" \
40-
license="Apache-2.0" \
41-
vendor="IBM"
40+
LABEL org.opencontainers.image.created="${CREATED}" \
41+
org.opencontainers.image.description="Hyperledger Fabric-X ${BIN} packaged in a UBI image." \
42+
org.opencontainers.image.licenses="Apache-2.0" \
43+
org.opencontainers.image.ref.name="ubi9/ubi-minimal" \
44+
org.opencontainers.image.revision="${REVISION}" \
45+
org.opencontainers.image.source="https://github.com/hyperledger/fabric-x-committer" \
46+
org.opencontainers.image.title="fabric-x-${BIN}" \
47+
org.opencontainers.image.url="https://github.com/hyperledger/fabric-x-committer" \
48+
org.opencontainers.image.version="${VERSION}"
4249

4350
# Use non-root user and set workdir using BIN argument
4451
USER 10001

docker/images/test_node/Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ RUN chmod a+x ${BINS_PATH}/*
4343
EXPOSE 7050 4001 2114 7001 2117 2110
4444

4545
# OCI metadata labels
46-
LABEL name="fabric-x-committer-test-node" \
47-
maintainer="IBM Research Decentralized Trust Group" \
48-
version="${VERSION}" \
49-
description="Preconfigured Hyperledger Fabric-X Committer Node" \
50-
license="Apache-2.0" \
51-
vendor="IBM"
46+
LABEL org.opencontainers.image.created="${CREATED}" \
47+
org.opencontainers.image.description="Hyperledger Fabric-X Committer Test Node." \
48+
org.opencontainers.image.licenses="Apache-2.0" \
49+
org.opencontainers.image.ref.name="postgres" \
50+
org.opencontainers.image.revision="${REVISION}" \
51+
org.opencontainers.image.source="https://github.com/hyperledger/fabric-x-committer" \
52+
org.opencontainers.image.title="fabric-x-committer-test-node" \
53+
org.opencontainers.image.url="https://github.com/hyperledger/fabric-x-committer" \
54+
org.opencontainers.image.version="${VERSION}"
5255

5356
# Default CMD
5457
CMD ["run"]

scripts/build-release-image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ function build_image() {
2626
--build-arg PORTS="${service_ports}"
2727
--build-arg ARCHBIN_PATH="${arch_bin_dir}"
2828
--build-arg VERSION="${version}"
29+
--build-arg CREATED="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
30+
--build-arg REVISION="$(git rev-parse HEAD)"
2931
)
3032

3133
if [ "${multiplatform}" = true ]; then

0 commit comments

Comments
 (0)