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

yikun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new 406eb86  [SPARK-43371] Minimize duplication across layers for chmod
406eb86 is described below

commit 406eb86c2cc722458e0a4787e759802dda5c73eb
Author: Yikun Jiang <yikunk...@gmail.com>
AuthorDate: Sat May 6 17:24:12 2023 +0800

    [SPARK-43371] Minimize duplication across layers for chmod
    
    ### What changes were proposed in this pull request?
    This patch minimizes duplication across layers for chmod:
    - Move `chmod g+w /opt/spark/work-dir` to layer of `/opt/spark/work-dir` 
creation
    - Move `chmod a+x /opt/decom.sh` to layer of spark extration layer.
    - `chmod a+x $VERSION/$TAG/entrypoint.sh` when generate the entrypoint.sh
    - ./add-dockerfiles.sh 3.4.0 to apply changes
    
    ### Why are the changes needed?
    Address DOI review comments to minimize duplication across layers for chmod
    > To minimize duplication across layers, chmod's should be done in the 
layer that creates the file/folder (or in the case of a file from the context 
via COPY, it should have the +x committed to git)
    
    
https://github.com/docker-library/official-images/pull/13089#issuecomment-1533540388
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    CI passed
    
    Closes #37 from Yikun/SPARK-43371.
    
    Authored-by: Yikun Jiang <yikunk...@gmail.com>
    Signed-off-by: Yikun Jiang <yikunk...@gmail.com>
---
 3.4.0/scala2.12-java11-ubuntu/Dockerfile    | 5 ++---
 3.4.0/scala2.12-java11-ubuntu/entrypoint.sh | 0
 Dockerfile.template                         | 5 ++---
 add-dockerfiles.sh                          | 1 +
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/3.4.0/scala2.12-java11-ubuntu/Dockerfile 
b/3.4.0/scala2.12-java11-ubuntu/Dockerfile
index 997b8d3..21d95d4 100644
--- a/3.4.0/scala2.12-java11-ubuntu/Dockerfile
+++ b/3.4.0/scala2.12-java11-ubuntu/Dockerfile
@@ -29,6 +29,7 @@ RUN set -ex && \
     mkdir /opt/spark/python && \
     mkdir -p /opt/spark/examples && \
     mkdir -p /opt/spark/work-dir && \
+    chmod g+w /opt/spark/work-dir && \
     touch /opt/spark/RELEASE && \
     chown -R spark:spark /opt/spark && \
     rm /bin/sh && \
@@ -68,6 +69,7 @@ RUN set -ex; \
     mv python/pyspark /opt/spark/python/pyspark/; \
     mv python/lib /opt/spark/python/lib/; \
     mv R /opt/spark/; \
+    chmod a+x /opt/decom.sh; \
     cd ..; \
     rm -rf "$SPARK_TMP";
 
@@ -76,8 +78,5 @@ COPY entrypoint.sh /opt/
 ENV SPARK_HOME /opt/spark
 
 WORKDIR /opt/spark/work-dir
-RUN chmod g+w /opt/spark/work-dir
-RUN chmod a+x /opt/decom.sh
-RUN chmod a+x /opt/entrypoint.sh
 
 ENTRYPOINT [ "/opt/entrypoint.sh" ]
diff --git a/3.4.0/scala2.12-java11-ubuntu/entrypoint.sh 
b/3.4.0/scala2.12-java11-ubuntu/entrypoint.sh
old mode 100644
new mode 100755
diff --git a/Dockerfile.template b/Dockerfile.template
index 5fe4f25..db01a87 100644
--- a/Dockerfile.template
+++ b/Dockerfile.template
@@ -29,6 +29,7 @@ RUN set -ex && \
     mkdir /opt/spark/python && \
     mkdir -p /opt/spark/examples && \
     mkdir -p /opt/spark/work-dir && \
+    chmod g+w /opt/spark/work-dir && \
     touch /opt/spark/RELEASE && \
     chown -R spark:spark /opt/spark && \
     rm /bin/sh && \
@@ -68,6 +69,7 @@ RUN set -ex; \
     mv python/pyspark /opt/spark/python/pyspark/; \
     mv python/lib /opt/spark/python/lib/; \
     mv R /opt/spark/; \
+    chmod a+x /opt/decom.sh; \
     cd ..; \
     rm -rf "$SPARK_TMP";
 
@@ -76,8 +78,5 @@ COPY entrypoint.sh /opt/
 ENV SPARK_HOME /opt/spark
 
 WORKDIR /opt/spark/work-dir
-RUN chmod g+w /opt/spark/work-dir
-RUN chmod a+x /opt/decom.sh
-RUN chmod a+x /opt/entrypoint.sh
 
 ENTRYPOINT [ "/opt/entrypoint.sh" ]
diff --git a/add-dockerfiles.sh b/add-dockerfiles.sh
index 7dcd7b0..d61601e 100755
--- a/add-dockerfiles.sh
+++ b/add-dockerfiles.sh
@@ -52,6 +52,7 @@ for TAG in $TAGS; do
     if [ "$TAG" == "scala2.12-java11-ubuntu" ]; then
         python3 tools/template.py $OPTS > $VERSION/$TAG/Dockerfile
         python3 tools/template.py $OPTS -f entrypoint.sh.template > 
$VERSION/$TAG/entrypoint.sh
+        chmod a+x $VERSION/$TAG/entrypoint.sh
     else
         python3 tools/template.py $OPTS -f r-python.template > 
$VERSION/$TAG/Dockerfile
     fi


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to