gemini-code-assist[bot] commented on code in PR #39291:
URL: https://github.com/apache/beam/pull/39291#discussion_r3563341265


##########
playground/backend/containers/scio/Dockerfile:
##########
@@ -52,11 +52,21 @@ COPY --from=build 
/go/src/playground/backend/new_scio_project.sh /opt/playground
 COPY --from=build 
/go/src/playground/backend/internal/fs_tool/ExampleData.scala 
/opt/playground/backend/
 RUN chmod +x /opt/playground/backend/new_scio_project.sh
 
-# Install sbt
-RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee 
/etc/apt/sources.list.d/sbt.list &&\
-echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee 
/etc/apt/sources.list.d/sbt_old.list &&\
-curl -sL 
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823";
 | apt-key add
-RUN apt-get update && apt-get install -y sbt
+# Install sbt 1.x
+RUN apt-get update \
+    && apt-get install -y --no-install-recommends \
+        ca-certificates \
+        curl \
+        gnupg \
+    && mkdir -p /etc/apt/keyrings \
+    && curl -fsSL \
+        
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823";
 \
+      | gpg --dearmor -o /etc/apt/keyrings/scalasbt.gpg \

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using a pipe (`|`) with `curl` can lead to silent failures because the 
default shell (`/bin/sh`) does not have `pipefail` enabled by default. If the 
`curl` command fails (e.g., due to network issues or keyserver downtime), the 
pipeline might still exit with a success status, leading to an empty or 
corrupted keyring file and causing harder-to-debug failures later in the build 
process.
   
   To prevent this, download the key to a temporary file first, dearmor it, and 
then remove the temporary file.
   
   ```
       && curl -fsSL 
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823";
 -o /tmp/scalasbt.key \
       && gpg --dearmor -o /etc/apt/keyrings/scalasbt.gpg /tmp/scalasbt.key \
       && rm /tmp/scalasbt.key \
   ```



-- 
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]

Reply via email to