@@ -13,12 +13,20 @@ FROM stackable/image/java-devel AS hive-builder
1313ARG PRODUCT
1414ARG HADOOP
1515ARG JMX_EXPORTER
16+ ARG AWS_JAVA_SDK_BUNDLE
17+ ARG AZURE_STORAGE
18+ ARG AZURE_KEYVAULT_CORE
1619ARG STACKABLE_USER_UID
1720
1821# Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
1922# This can be used to speed up builds when disk space is of no concern.
2023ARG DELETE_CACHES="true"
2124
25+ # It is useful to see which version of Hadoop is used at a glance
26+ # Therefore the use of the full name here
27+ # TODO: Do we really need all of Hadoop in here?
28+ COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-builder /stackable/hadoop /stackable/hadoop-${HADOOP}
29+
2230COPY --chown=${STACKABLE_USER_UID}:0 hive/stackable /stackable
2331
2432USER ${STACKABLE_USER_UID}
@@ -58,6 +66,18 @@ rm -rf /stackable/apache-hive-${PRODUCT}-src
5866curl "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" -o "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
5967ln -s "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" /stackable/jmx/jmx_prometheus_javaagent.jar
6068
69+ # The next two sections for S3 and Azure use hardcoded version numbers on purpose instead of wildcards
70+ # This way the build will fail should one of the files not be available anymore in a later Hadoop version!
71+
72+ # Add S3 Support for Hive (support for s3a://)
73+ cp /stackable/hadoop-${HADOOP}/share/hadoop/tools/lib/hadoop-aws-${HADOOP}.jar /stackable/apache-hive-metastore-${PRODUCT}-bin/lib/
74+ cp /stackable/hadoop-${HADOOP}/share/hadoop/tools/lib/aws-java-sdk-bundle-${AWS_JAVA_SDK_BUNDLE}.jar /stackable/apache-hive-metastore-${PRODUCT}-bin/lib/
75+
76+ # Add Azure ABFS support (support for abfs://)
77+ cp /stackable/hadoop-${HADOOP}/share/hadoop/tools/lib/hadoop-azure-${HADOOP}.jar /stackable/apache-hive-metastore-${PRODUCT}-bin/lib/
78+ cp /stackable/hadoop-${HADOOP}/share/hadoop/tools/lib/azure-storage-${AZURE_STORAGE}.jar /stackable/apache-hive-metastore-${PRODUCT}-bin/lib/
79+ cp /stackable/hadoop-${HADOOP}/share/hadoop/tools/lib/azure-keyvault-core-${AZURE_KEYVAULT_CORE}.jar /stackable/apache-hive-metastore-${PRODUCT}-bin/lib/
80+
6181# We're removing these to make the intermediate layer smaller
6282# This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
6383# and we are sometimes running into errors because we're out of space.
@@ -67,6 +87,9 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
6787 rm -rf /stackable/.npm/*
6888 rm -rf /stackable/.cache/*
6989fi
90+
91+ # change groups
92+ chmod -R g=u /stackable
7093EOF
7194
7295
@@ -75,9 +98,6 @@ FROM stackable/image/java-base AS final
7598ARG PRODUCT
7699ARG HADOOP
77100ARG RELEASE
78- ARG AWS_JAVA_SDK_BUNDLE
79- ARG AZURE_STORAGE
80- ARG AZURE_KEYVAULT_CORE
81101ARG STACKABLE_USER_UID
82102
83103
@@ -106,44 +126,26 @@ LABEL io.k8s.display-name="${NAME}"
106126WORKDIR /stackable
107127
108128COPY --chown=${STACKABLE_USER_UID}:0 --from=hive-builder /stackable/apache-hive-metastore-${PRODUCT}-bin /stackable/apache-hive-metastore-${PRODUCT}-bin
129+ COPY --chown=${STACKABLE_USER_UID}:0 --from=hive-builder /stackable/hadoop-${HADOOP} /stackable/hadoop-${HADOOP}
130+ COPY --chown=${STACKABLE_USER_UID}:0 --from=hive-builder /stackable/jmx /stackable/jmx
109131
110- # It is useful to see which version of Hadoop is used at a glance
111- # Therefore the use of the full name here
112- # TODO: Do we really need all of Hadoop in here?
113- COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-builder /stackable/hadoop /stackable/hadoop-${HADOOP}
132+ COPY hive/licenses /licenses
114133
115134RUN <<EOF
116135microdnf update
117136microdnf clean all
118137rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n " | sort > /stackable/package_manifest.txt
138+ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
119139rm -rf /var/cache/yum
120140
121141ln -s /stackable/apache-hive-metastore-${PRODUCT}-bin /stackable/hive-metastore
142+ chown -h ${STACKABLE_USER_UID}:0 /stackable/hive-metastore
122143ln -s /stackable/hadoop-${HADOOP} /stackable/hadoop
123-
124- # The next two sections for S3 and Azure use hardcoded version numbers on purpose instead of wildcards
125- # This way the build will fail should one of the files not be available anymore in a later Hadoop version!
126-
127- # Add S3 Support for Hive (support for s3a://)
128- cp /stackable/hadoop/share/hadoop/tools/lib/hadoop-aws-${HADOOP}.jar /stackable/hive-metastore/lib/
129- cp /stackable/hadoop/share/hadoop/tools/lib/aws-java-sdk-bundle-${AWS_JAVA_SDK_BUNDLE}.jar /stackable/hive-metastore/lib/
130-
131- # Add Azure ABFS support (support for abfs://)
132- cp /stackable/hadoop/share/hadoop/tools/lib/hadoop-azure-${HADOOP}.jar /stackable/hive-metastore/lib/
133- cp /stackable/hadoop/share/hadoop/tools/lib/azure-storage-${AZURE_STORAGE}.jar /stackable/hive-metastore/lib/
134- cp /stackable/hadoop/share/hadoop/tools/lib/azure-keyvault-core-${AZURE_KEYVAULT_CORE}.jar /stackable/hive-metastore/lib/
135-
136- # All files and folders owned by root group to support running as arbitrary users.
137- # This is best practice as all container users will belong to the root group (0).
138- chown -R ${STACKABLE_USER_UID}:0 /stackable
139- chmod -R g=u /stackable
144+ chown -h ${STACKABLE_USER_UID}:0 /stackable/hadoop
140145EOF
141146
142- COPY --chown=${STACKABLE_USER_UID}:0 --from=hive-builder /stackable/jmx /stackable/jmx
143- COPY hive/licenses /licenses
144-
145147# ----------------------------------------
146- # Attention: We are changing the group of all files in /stackable directly above
148+ # Attention:
147149# If you do any file based actions (copying / creating etc.) below this comment you
148150# absolutely need to make sure that the correct permissions are applied!
149151# chown ${STACKABLE_USER_UID}:0
0 commit comments