Skip to content

Commit 2a9f7ad

Browse files
added OCI metadata labels for fabric-x-tools Docker image (#41)
Signed-off-by: Anushka <anush159@in.ibm.com> Signed-off-by: pco <pasquale.convertini@ibm.com> Signed-off-by: anushka159-a <anush159@in.ibm.com> Co-authored-by: pco <pasquale.convertini@ibm.com>
1 parent 50857d8 commit 2a9f7ad

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

.github/workflows/build-image.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ jobs:
5353
exit 1
5454
fi
5555
56-
- name: Set image prefix
56+
- name: Set image build prefix and metadata
5757
run: |
58+
echo "CREATED=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
59+
echo "REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
5860
if [ "$GITHUB_REPOSITORY_OWNER" == "hyperledger" ]; then
5961
echo "IMAGE_PREFIX=hyperledger" >> $GITHUB_ENV
6062
else
@@ -70,6 +72,8 @@ jobs:
7072
push: true
7173
build-args: |
7274
VERSION=${{ env.VERSION }}
75+
CREATED=${{ env.CREATED }}
76+
REVISION=${{ env.REVISION }}
7377
tags: |
7478
docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:${{ env.VERSION }}
7579
docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-tools:latest

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ RUN mkdir -p /tmp/bin && \
3838
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6 AS prod
3939

4040
ARG VERSION=1.0
41+
ARG CREATED
42+
ARG REVISION=1.0
4143

4244
# Add non-root user (UID 10001) without installing extra packages
4345
RUN /usr/sbin/useradd -u 10001 -r -g root -s /sbin/nologin \
@@ -50,12 +52,15 @@ RUN /usr/sbin/useradd -u 10001 -r -g root -s /sbin/nologin \
5052
COPY --from=builder /tmp/bin/* /usr/local/bin/
5153

5254
# OCI metadata labels
53-
LABEL name="fabric-x-tools" \
54-
maintainer="IBM Research Decentralized Trust Group" \
55-
version="${VERSION}" \
56-
description="Fabric-X CLI tools (configtxgen, cryptogen, configtxlator, fxconfig) packaged in a UBI image" \
57-
license="Apache-2.0" \
58-
vendor="IBM"
55+
LABEL org.opencontainers.image.created="${CREATED}" \
56+
org.opencontainers.image.description="Fabric-X CLI tools (configtxgen, cryptogen, configtxlator, fxconfig) packaged in a UBI image." \
57+
org.opencontainers.image.licenses="Apache-2.0" \
58+
org.opencontainers.image.ref.name="ubi9/ubi-minimal" \
59+
org.opencontainers.image.revision="${REVISION}" \
60+
org.opencontainers.image.source="https://github.com/hyperledger/fabric-x" \
61+
org.opencontainers.image.title="fabric-x" \
62+
org.opencontainers.image.url="https://github.com/hyperledger/fabric-x" \
63+
org.opencontainers.image.version="${VERSION}"
5964

6065
# Use non-root user
6166
USER 10001

0 commit comments

Comments
 (0)