codeant-ai-for-open-source[bot] commented on code in PR #42586:
URL: https://github.com/apache/superset/pull/42586#discussion_r3679223449


##########
docs/admin_docs/installation/docker-builds.mdx:
##########
@@ -112,12 +112,57 @@ USER superset
 CMD ["/app/docker/entrypoints/run-server.sh"]
 ```
 
+### Adding translations to a custom image
+
+The pattern above, a small Dockerfile that just extends `FROM 
apache/superset:...`, can't add
+translations after the fact. By the time an official tag is published, its 
frontend and backend
+layers have already had non-English translation files stripped out unless 
`BUILD_TRANSLATIONS`
+was set at build time (see below), and there's no `superset/translations` 
source tree left in the
+final image to compile from.
+
+To get translations into your own image, you need to build from the full 
Superset source (a
+clone or fork of this repo) rather than extend a published tag. The most 
efficient way to do this
+is to append your customizations as one more stage at the end of the repo's 
own `Dockerfile`, so
+Docker can reuse the cached upstream layers and only rebuild what your stage 
adds:
+
+```Dockerfile
+# Append this to the end of the repo's Dockerfile
+# Keep this tag in sync with the branch/tag of the repo you cloned, so the
+# translation files built from source match the keys the runtime expects:
+FROM apache/superset:5.0.0 AS my-custom-image
+USER root
+
+# Pull the compiled translation files out of the earlier build stages. These
+# only exist mid-build (frontend .json in `superset-node`, backend .mo in
+# `python-translation-compiler`) and get stripped from the final `lean`/`dev`
+# stages unless BUILD_TRANSLATIONS=true.

Review Comment:
   **Suggestion:** The cleanup patterns in the referenced Dockerfile use 
character classes such as `*.[po,mo]` and `*.[po,json]`, which do not match the 
multi-character `.po`, `.mo`, or `.json` extensions. Consequently, these 
intermediate stages still contain the source `.po` files, and both `COPY` 
commands copy them into the custom image. Correct the Dockerfile cleanup 
patterns or update this documentation so it does not claim that only compiled 
files are copied and that source files have been stripped. [comment mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Custom translation images retain source `.po` files.
   - ⚠️ Images may also retain unnecessary frontend `.json` sources.
   - ⚠️ Documentation describes cleanup behavior inaccurately.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=626f69b2100f48208409e840c61c624b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=626f69b2100f48208409e840c61c624b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/admin_docs/installation/docker-builds.mdx
   **Line:** 135:138
   **Comment:**
        *Comment Mismatch: The cleanup patterns in the referenced Dockerfile 
use character classes such as `*.[po,mo]` and `*.[po,json]`, which do not match 
the multi-character `.po`, `.mo`, or `.json` extensions. Consequently, these 
intermediate stages still contain the source `.po` files, and both `COPY` 
commands copy them into the custom image. Correct the Dockerfile cleanup 
patterns or update this documentation so it does not claim that only compiled 
files are copied and that source files have been stripped.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42586&comment_hash=02172dba9ccadc265c7d8945488326c2d52eda16d60f3aa027f487be106ac6f3&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42586&comment_hash=02172dba9ccadc265c7d8945488326c2d52eda16d60f3aa027f487be106ac6f3&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to