Skip to content

Commit 74d5465

Browse files
Add OCI labels to docker images (#438)
Issue aws-controllers-k8s/community#1758 Description of changes: Add some OCI labels to docker images The labels are documented at https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys Importantly to me, `org.opencontainers.image.source` is used by renovate's changelog support. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4be9ee7 commit 74d5465

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ RUN GIT_VERSION=$service_controller_git_version && \
5050
-a -o $work_dir/bin/controller $work_dir/cmd/controller/main.go
5151

5252
FROM $base_image
53+
ARG base_image
54+
LABEL org.opencontainers.image.base.name=$base_image
5355
ARG service_alias
56+
ARG service_controller_git_version
5457
ARG work_dir=/github.com/aws-controllers-k8s/$service_alias-controller
58+
LABEL org.opencontainers.image.source=https://github.com/aws-controllers-k8s/$service_alias-controller
59+
LABEL org.opencontainers.image.version=$service_controller_git_version
5560
WORKDIR /
5661
COPY --from=builder $work_dir/bin/controller $work_dir/LICENSE $work_dir/ATTRIBUTION.md /bin/
5762
# Make this image non-root by default

Dockerfile.local

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ RUN GIT_VERSION=$service_controller_git_version && \
6262
-a -o $work_dir/bin/controller $work_dir/cmd/controller/main.go
6363

6464
FROM $base_image
65+
ARG base_image
66+
LABEL org.opencontainers.image.base.name=$base_image
6567
ARG service_alias
68+
ARG service_controller_git_version
6669
ARG work_dir=/github.com/aws-controllers-k8s/$service_alias-controller
70+
LABEL org.opencontainers.image.source=https://github.com/aws-controllers-k8s/$service_alias-controller
71+
LABEL org.opencontainers.image.version=$service_controller_git_version
6772
WORKDIR /
6873
COPY --from=builder $work_dir/bin/controller $work_dir/LICENSE $work_dir/ATTRIBUTION.md /bin/
6974
USER 1000

0 commit comments

Comments
 (0)