File tree Expand file tree Collapse file tree 8 files changed +44
-22
lines changed
scala2.12-java11-python3-r-ubuntu
scala2.12-java11-python3-ubuntu
scala2.12-java11-r-ubuntu Expand file tree Collapse file tree 8 files changed +44
-22
lines changed Original file line number Diff line number Diff line change 1616#
1717FROM spark:3.4.0-scala2.12-java11-ubuntu
1818
19+ USER root
20+
1921RUN set -ex; \
2022 apt-get update; \
2123 apt install -y python3 python3-pip; \
@@ -24,3 +26,5 @@ RUN set -ex; \
2426 rm -rf /var/lib/apt/lists/*
2527
2628ENV R_HOME /usr/lib/R
29+
30+ USER spark
Original file line number Diff line number Diff line change 1616#
1717FROM spark:3.4.0-scala2.12-java11-ubuntu
1818
19+ USER root
20+
1921RUN set -ex; \
2022 apt-get update; \
2123 apt install -y python3 python3-pip; \
2224 rm -rf /var/cache/apt/*; \
2325 rm -rf /var/lib/apt/lists/*
26+
27+ USER spark
Original file line number Diff line number Diff line change 1616#
1717FROM spark:3.4.0-scala2.12-java11-ubuntu
1818
19+ USER root
20+
1921RUN set -ex; \
2022 apt-get update; \
2123 apt install -y r-base r-base-dev; \
2224 rm -rf /var/cache/apt/*; \
2325 rm -rf /var/lib/apt/lists/*
2426
2527ENV R_HOME /usr/lib/R
28+
29+ USER spark
Original file line number Diff line number Diff line change @@ -77,4 +77,6 @@ ENV SPARK_HOME /opt/spark
7777
7878WORKDIR /opt/spark/work-dir
7979
80+ USER spark
81+
8082ENTRYPOINT [ "/opt/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ elif ! [ -z ${SPARK_HOME+x} ]; then
6969 SPARK_CLASSPATH=" $SPARK_HOME /conf:$SPARK_CLASSPATH " ;
7070fi
7171
72+ # Switch to spark if no USER specified (root by default) otherwise use USER directly
73+ switch_spark_if_root () {
74+ if [ $( id -u) -eq 0 ]; then
75+ echo gosu spark
76+ fi
77+ }
78+
7279case " $1 " in
7380 driver)
7481 shift 1
@@ -78,6 +85,8 @@ case "$1" in
7885 --deploy-mode client
7986 " $@ "
8087 )
88+ # Execute the container CMD under tini for better hygiene
89+ exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
8190 ;;
8291 executor)
8392 shift 1
@@ -96,20 +105,12 @@ case "$1" in
96105 --resourceProfileId $SPARK_RESOURCE_PROFILE_ID
97106 --podName $SPARK_EXECUTOR_POD_NAME
98107 )
108+ # Execute the container CMD under tini for better hygiene
109+ exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
99110 ;;
100111
101112 * )
102113 # Non-spark-on-k8s command provided, proceeding in pass-through mode...
103- CMD=( " $@ " )
114+ exec " $@ "
104115 ;;
105116esac
106-
107- # Switch to spark if no USER specified (root by default) otherwise use USER directly
108- switch_spark_if_root () {
109- if [ $( id -u) -eq 0 ]; then
110- echo gosu spark
111- fi
112- }
113-
114- # Execute the container CMD under tini for better hygiene
115- exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
Original file line number Diff line number Diff line change @@ -77,4 +77,6 @@ ENV SPARK_HOME /opt/spark
7777
7878WORKDIR /opt/spark/work-dir
7979
80+ USER spark
81+
8082ENTRYPOINT [ "/opt/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ elif ! [ -z ${SPARK_HOME+x} ]; then
6969 SPARK_CLASSPATH=" $SPARK_HOME /conf:$SPARK_CLASSPATH " ;
7070fi
7171
72+ # Switch to spark if no USER specified (root by default) otherwise use USER directly
73+ switch_spark_if_root () {
74+ if [ $( id -u) -eq 0 ]; then
75+ echo gosu spark
76+ fi
77+ }
78+
7279case " $1 " in
7380 driver)
7481 shift 1
@@ -78,6 +85,8 @@ case "$1" in
7885 --deploy-mode client
7986 " $@ "
8087 )
88+ # Execute the container CMD under tini for better hygiene
89+ exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
8190 ;;
8291 executor)
8392 shift 1
@@ -96,20 +105,12 @@ case "$1" in
96105 --resourceProfileId $SPARK_RESOURCE_PROFILE_ID
97106 --podName $SPARK_EXECUTOR_POD_NAME
98107 )
108+ # Execute the container CMD under tini for better hygiene
109+ exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
99110 ;;
100111
101112 * )
102113 # Non-spark-on-k8s command provided, proceeding in pass-through mode...
103- CMD=( " $@ " )
114+ exec " $@ "
104115 ;;
105116esac
106-
107- # Switch to spark if no USER specified (root by default) otherwise use USER directly
108- switch_spark_if_root () {
109- if [ $( id -u) -eq 0 ]; then
110- echo gosu spark
111- fi
112- }
113-
114- # Execute the container CMD under tini for better hygiene
115- exec $( switch_spark_if_root) /usr/bin/tini -s -- " ${CMD[@]} "
Original file line number Diff line number Diff line change 1616#
1717FROM spark:{{ SPARK_VERSION }}-scala{{ SCALA_VERSION }}-java{{ JAVA_VERSION }}-ubuntu
1818
19+ USER root
20+
1921RUN set -ex; \
2022 apt-get update; \
2123 {%- if HAVE_PY %}
@@ -30,3 +32,5 @@ RUN set -ex; \
3032
3133ENV R_HOME /usr/lib/R
3234{%- endif %}
35+
36+ USER spark
You can’t perform that action at this time.
0 commit comments