This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch docker_docs
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a376b2b409bab18b227f31cf7e09921e83894798
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Wed Jan 31 10:09:05 2024 -0800

    feat: docker image tags documentation + tweaks
    
    This PR adds a new page to the docs under "Installation and
    Configuration" titled "Docker Images and Tags"
    
    It also:
    - adds new tags for PRs as in `PR_5287` + unit tests for that
    - points the docker-compose-non-dev, which assumes prod to the lean
      build (`latest`) since the dev build isn't as secure
---
 docker-compose-non-dev.yml               |  2 +-
 docs/README.md                           |  5 +++-
 docs/docs/installation/docker.mdx        | 51 ++++++++++++++++++++++++++++++++
 helm/superset/README.md                  |  2 +-
 helm/superset/values.yaml                |  2 +-
 scripts/build_docker.py                  |  2 ++
 tests/unit_tests/scripts/docker_build.py | 14 +++++----
 7 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/docker-compose-non-dev.yml b/docker-compose-non-dev.yml
index cf36ae833d..34aec9bbb7 100644
--- a/docker-compose-non-dev.yml
+++ b/docker-compose-non-dev.yml
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-x-superset-image: &superset-image 
apachesuperset.docker.scarf.sh/apache/superset:${TAG:-latest-dev}
+x-superset-image: &superset-image 
apachesuperset.docker.scarf.sh/apache/superset:${TAG:-latest}
 x-superset-depends-on: &superset-depends-on
   - db
   - redis
diff --git a/docs/README.md b/docs/README.md
index 1e6107564a..cccd379862 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -16,4 +16,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-This is the public documentation site for Superset, built using [Docusaurus 
2](https://docusaurus.io/). See 
[CONTRIBUTING.md](../CONTRIBUTING.md#documentation) for documentation on 
contributing to documentation.
+This is the public documentation site for Superset, built using
+[Docusaurus 2](https://docusaurus.io/). See
+[CONTRIBUTING.md](../CONTRIBUTING.md#documentation) for documentation on
+contributing to documentation.
diff --git a/docs/docs/installation/docker.mdx 
b/docs/docs/installation/docker.mdx
new file mode 100644
index 0000000000..8282b495ea
--- /dev/null
+++ b/docs/docs/installation/docker.mdx
@@ -0,0 +1,51 @@
+# Docker Images and Tags
+
+The Apache Superset community extensively uses Docker for development, release,
+and productionizing Superset. This page details our Docker builds and tag 
naming
+schemes to help users navigate our offerings.
+
+Images are built and pushed to the [Superset Docker Hub repository](
+https://hub.docker.com/r/apache/superset). Different sets of images are 
created for:
+- Published releases, with tags like `3.0.0` and the `latest` tag.
+- Pull request iterations, each identified by tags starting with a SHA like
+  `8a2f7d378ab13c156fa183d9284b607ed69f5ecc`, and `pr-3454`, referencing the 
pull
+  request ID.
+- Merges to the main branch (`master`), resulting in new SHAs, with tags
+  prefixed with `master` for the latest `master` version.
+
+Each code version has multiple builds for different purposes, identified by 
suffixes:
+- **Build Preset:** We offer various images for different needs:
+  - **Lean:** The default Docker image, including both frontend and backend. 
Tags
+    without a build_preset are lean builds, e.g., `latest`.
+  - **Dev:** For development, with a headless browser and root access.
+  - **Py310:** Similar to lean but with Python 3.10.
+  - **CI:** For certain CI workloads.
+  - **WebSocket:** For Superset clusters supporting advanced features.
+  - **Dockerize:** Used by Helm.
+- **Platform:** We build for `linux/arm64` and `linux/amd64`. The `-arm` suffix
+  indicates ARM builds (e.g., `latest-arm`), while tags without a suffix are 
for
+  AMD (e.g., `latest`).
+
+## Key Image Tags and Examples
+
+- `latest`: The latest official release build, implicitly the lean build on
+  `linux/amd64`.
+- `latest-dev`
+- `master`: The latest build from the `master` branch, implicitly lean on
+  `linux/amd64`.
+- `master-dev`: Similar to `master` but includes a headless browser and root 
access.
+- `PR-5252`: The latest commit in PR 5252.
+- `30948dc401b40982cb7c0dbf6ebbe443b2748c1b-dev-arm`: A `linux/arm64` build for
+  this specific SHA, which could be from a pull request, master merge, or 
release.
+- `30948dc-dev-arm`: Same as above, but SHA truncated to 7 characters for a
+  shorter handle on the same image
+- `websocket-latest`: The WebSocket image for use in a Superset cluster.
+
+For insights or modifications to the build matrix and tagging conventions,
+check the 
[build_docker.py](https://github.com/apache/superset/blob/master/scripts/build_docker.py)
+script and the 
[docker.yml](https://github.com/apache/superset/blob/master/.github/workflows/docker.yml)
+GitHub action.
+
+## Caching
+
+To accelerate builds, we follow Docker best practices and use 
`apache/superset-cache`.
diff --git a/helm/superset/README.md b/helm/superset/README.md
index 27c1232440..69d225ec04 100644
--- a/helm/superset/README.md
+++ b/helm/superset/README.md
@@ -77,7 +77,7 @@ On helm this can be set on 
`extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverri
 | hostAliases | list | `[]` | Custom hostAliases for all superset pods # 
https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/ |
 | image.pullPolicy | string | `"IfNotPresent"` |  |
 | image.repository | string | 
`"apachesuperset.docker.scarf.sh/apache/superset"` |  |
-| image.tag | string | `""` |  |
+| image.tag | string | `"latest"` |  |
 | imagePullSecrets | list | `[]` |  |
 | ingress.annotations | object | `{}` |  |
 | ingress.enabled | bool | `false` |  |
diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml
index 15c5f7e214..3d96009d80 100644
--- a/helm/superset/values.yaml
+++ b/helm/superset/values.yaml
@@ -179,7 +179,7 @@ extraConfigMountPath: "/app/configs"
 
 image:
   repository: apachesuperset.docker.scarf.sh/apache/superset
-  tag: ""
+  tag: "latest"
   pullPolicy: IfNotPresent
 
 imagePullSecrets: []
diff --git a/scripts/build_docker.py b/scripts/build_docker.py
index f2323eb7ed..6d80933aa8 100755
--- a/scripts/build_docker.py
+++ b/scripts/build_docker.py
@@ -115,6 +115,8 @@ def get_docker_tags(
             tags.add(make_docker_tag(["latest"] + tag_chunks))
     elif build_context == "push" and build_context_ref == "master":
         tags.add(make_docker_tag(["master"] + tag_chunks))
+    elif build_context == "pull_request":
+        tags.add(make_docker_tag([f"PR-{build_context_ref}"] + tag_chunks))
     return tags
 
 
diff --git a/tests/unit_tests/scripts/docker_build.py 
b/tests/unit_tests/scripts/docker_build.py
index 002a51f27d..8e78c412c2 100644
--- a/tests/unit_tests/scripts/docker_build.py
+++ b/tests/unit_tests/scripts/docker_build.py
@@ -65,7 +65,7 @@ def test_is_latest_release(release, expected_bool):
             SHA,
             "pull_request",
             PR_ID,
-            [f"{REPO}:22e7c60-arm", f"{REPO}:{SHA}-arm"],
+            [f"{REPO}:22e7c60-arm", f"{REPO}:{SHA}-arm", 
f"{REPO}:PR-{PR_ID}-arm"],
         ),
         (
             "ci",
@@ -73,7 +73,7 @@ def test_is_latest_release(release, expected_bool):
             SHA,
             "pull_request",
             PR_ID,
-            [f"{REPO}:22e7c60-ci", f"{REPO}:{SHA}-ci"],
+            [f"{REPO}:22e7c60-ci", f"{REPO}:{SHA}-ci", 
f"{REPO}:PR-{PR_ID}-ci"],
         ),
         (
             "lean",
@@ -81,7 +81,7 @@ def test_is_latest_release(release, expected_bool):
             SHA,
             "pull_request",
             PR_ID,
-            [f"{REPO}:22e7c60", f"{REPO}:{SHA}"],
+            [f"{REPO}:22e7c60", f"{REPO}:{SHA}", f"{REPO}:PR-{PR_ID}"],
         ),
         (
             "dev",
@@ -89,7 +89,11 @@ def test_is_latest_release(release, expected_bool):
             SHA,
             "pull_request",
             PR_ID,
-            [f"{REPO}:22e7c60-dev-arm", f"{REPO}:{SHA}-dev-arm"],
+            [
+                f"{REPO}:22e7c60-dev-arm",
+                f"{REPO}:{SHA}-dev-arm",
+                f"{REPO}:PR-{PR_ID}-dev-arm",
+            ],
         ),
         (
             "dev",
@@ -97,7 +101,7 @@ def test_is_latest_release(release, expected_bool):
             SHA,
             "pull_request",
             PR_ID,
-            [f"{REPO}:22e7c60-dev", f"{REPO}:{SHA}-dev"],
+            [f"{REPO}:22e7c60-dev", f"{REPO}:{SHA}-dev", 
f"{REPO}:PR-{PR_ID}-dev"],
         ),
         # old releases
         (

Reply via email to