Skip to content

Commit

Permalink
[SPARK-49243][INFRA][K8S] Add OpenContainers Annotations in docker …
Browse files Browse the repository at this point in the history
…images

### What changes were proposed in this pull request?

This PR aims to add `OpenContainers` Annotations to docker image to add metadata like `Apache License`.

- https://specs.opencontainers.org/image-spec/annotations/

### Why are the changes needed?

**BEFORE**
```
$ docker inspect apache/spark:3.5.2 | jq '.[0].Config.Labels'
{
  "org.opencontainers.image.ref.name": "ubuntu",
  "org.opencontainers.image.version": "20.04"
}
```

**AFTER**

```
$ NO_MANUAL=1 ./dev/make-distribution.sh -Pkubernetes
$ bin/docker-image-tool.sh -t SPARK-49243 -n build
$ docker inspect spark:SPARK-49243 | jq '.[0].Config.Labels'
{
  "org.opencontainers.image.authors": "Apache Spark project <devspark.apache.org>",
  "org.opencontainers.image.licenses": "Apache-2.0",
  "org.opencontainers.image.ref.name": "Apache Spark Scala/Java Image",
  "org.opencontainers.image.version": ""
}
```

### Does this PR introduce _any_ user-facing change?

No, it's only a metadata change.

### How was this patch tested?

Manual review.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #47766 from dongjoon-hyun/SPARK-49243.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
  • Loading branch information
dongjoon-hyun committed Aug 15, 2024
1 parent def42d4 commit 470e3f9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dev/create-release/spark-rm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

# Image for building Spark releases. Based on Ubuntu 22.04.
FROM ubuntu:jammy-20240227
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.ref.name="Apache Spark Release Manager Image"
# Overwrite this label to avoid exposing the underlying Ubuntu OS version label
LABEL org.opencontainers.image.version=""

ENV FULL_REFRESH_DATE 20240318

Expand Down
5 changes: 5 additions & 0 deletions dev/infra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
# Image for building and testing Spark branches. Based on Ubuntu 22.04.
# See also in https://hub.docker.com/_/ubuntu
FROM ubuntu:jammy-20240227
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.ref.name="Apache Spark Infra Image"
# Overwrite this label to avoid exposing the underlying Ubuntu OS version label
LABEL org.opencontainers.image.version=""

ENV FULL_REFRESH_DATE 20240318

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
ARG java_image_tag=21

FROM azul/zulu-openjdk:${java_image_tag}
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.ref.name="Apache Spark Scala/Java Image"
# Overwrite this label to avoid exposing the underlying Ubuntu OS version label
LABEL org.opencontainers.image.version=""

ARG spark_uid=185

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
ARG base_img

FROM ${base_img:-spark}
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.ref.name="Apache Spark R Image"
# Overwrite this label to avoid exposing the underlying Ubuntu OS version label
LABEL org.opencontainers.image.version=""
WORKDIR /

# Reset to root to run installation tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
ARG base_img

FROM ${base_img:-spark}
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.ref.name="Apache Spark Python Image"
# Overwrite this label to avoid exposing the underlying Ubuntu OS version label
LABEL org.opencontainers.image.version=""
WORKDIR /

# Reset to root to run installation tasks
Expand Down

0 comments on commit 470e3f9

Please sign in to comment.