Skip to content

Commit 0b07019

Browse files
committed
Adjust Druid
1 parent 3f23ce9 commit 0b07019

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

airflow/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ mkdir -pv ${AIRFLOW_HOME}/dags
108108
mkdir -pv ${AIRFLOW_HOME}/logs
109109

110110
# All files and folders owned by root to support running as arbitrary users
111-
# This is best practice as all users will belong to group `0`
111+
# This is best practice as all container users will belong to the root group (0)
112112
chown -R ${STACKABLE_USER_UID}:0 /stackable
113113
chmod -R g=u /stackable
114114
EOF

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,5 @@
9494
"STACKABLE_USER_NAME": "stackable",
9595
"STACKABLE_USER_UID": "1000",
9696
"STACKABLE_USER_GID": "1000",
97+
"DELETE_CACHES": "true"
9798
}

druid/Dockerfile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ microdnf clean all
3030
rm -rf /var/cache/yum
3131
EOF
3232

33-
USER stackable
33+
USER ${STACKABLE_USER_UID}
3434
WORKDIR /stackable
3535

36-
COPY --chown=stackable:stackable druid/stackable/patches/apply_patches.sh /stackable/apache-druid-${PRODUCT}-src/patches/apply_patches.sh
37-
COPY --chown=stackable:stackable druid/stackable/patches/${PRODUCT} /stackable/apache-druid-${PRODUCT}-src/patches/${PRODUCT}
36+
COPY --chown=stackable:0 druid/stackable/patches/apply_patches.sh /stackable/apache-druid-${PRODUCT}-src/patches/apply_patches.sh
37+
COPY --chown=stackable:0 druid/stackable/patches/${PRODUCT} /stackable/apache-druid-${PRODUCT}-src/patches/${PRODUCT}
3838

3939
# Cache mounts are owned by root by default
4040
# We need to explicitly give the uid to use which is hardcoded to "1000" in stackable-base
@@ -44,9 +44,9 @@ COPY --chown=stackable:stackable druid/stackable/patches/${PRODUCT} /stackable/a
4444
# with a "directory not empty" error on the first builder to finish, as other builders
4545
# are still working in the cache directory.
4646

47-
RUN --mount=type=cache,id=maven-${PRODUCT},uid=1000,target=/stackable/.m2/repository \
48-
--mount=type=cache,id=npm-${PRODUCT},uid=1000,target=/stackable/.npm \
49-
--mount=type=cache,id=cache-${PRODUCT},uid=1000,target=/stackable/.cache \
47+
RUN --mount=type=cache,id=maven-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository \
48+
--mount=type=cache,id=npm-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.npm \
49+
--mount=type=cache,id=cache-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.cache \
5050
<<EOF
5151
curl --fail -L "https://repo.stackable.tech/repository/packages/druid/apache-druid-${PRODUCT}-src.tar.gz" | tar -xzC .
5252
cd apache-druid-${PRODUCT}-src
@@ -78,6 +78,7 @@ FROM stackable/image/java-base AS final
7878

7979
ARG PRODUCT
8080
ARG RELEASE
81+
ARG STACKABLE_USER_UID
8182

8283
ARG NAME="Apache Druid"
8384
ARG DESCRIPTION="This image is deployed by the Stackable Operator for Apache Druid"
@@ -101,27 +102,29 @@ LABEL io.openshift.tags="ubi9,stackable,druid,sdp"
101102
LABEL io.k8s.description="${DESCRIPTION}"
102103
LABEL io.k8s.display-name="${NAME}"
103104

105+
106+
COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/apache-druid-${PRODUCT} /stackable/apache-druid-${PRODUCT}
107+
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/bin /stackable/bin
108+
COPY --chown=${STACKABLE_USER_UID}:0 druid/licenses /licenses
109+
104110
RUN <<EOF
105111
microdnf update
106112
microdnf clean all
107113
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | sort > /stackable/package_manifest.txt
108114
rm -rf /var/cache/yum
109-
EOF
110-
111-
USER stackable
112-
WORKDIR /stackable
113-
114-
COPY --chown=stackable:stackable --from=druid-builder /stackable/apache-druid-${PRODUCT} /stackable/apache-druid-${PRODUCT}
115-
COPY --chown=stackable:stackable druid/stackable/bin /stackable/bin
116-
COPY --chown=stackable:stackable druid/licenses /licenses
117115

118-
RUN <<EOF
119116
ln -s /stackable/apache-druid-${PRODUCT} /stackable/druid
120117

121118
# Force to overwrite the existing 'run-druid'
122119
ln -sf /stackable/bin/run-druid /stackable/druid/bin/run-druid
120+
121+
# All files and folders owned by root to support running as arbitrary users
122+
# This is best practice as all container users will belong to the root group (0)
123+
chown -R ${STACKABLE_USER_UID}:0 /stackable
124+
chmod -R g=u /stackable
123125
EOF
124126

127+
USER ${STACKABLE_USER_UID}
125128
ENV PATH="${PATH}":/stackable/druid/bin
126129

127130
WORKDIR /stackable/druid

stackable-base/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ groupadd --gid ${STACKABLE_USER_GID} --system ${STACKABLE_USER_NAME}
112112
# Making this a system user prevents a mail dir from being created, expiry of passwords etc. but it will warn:
113113
# useradd warning: stackable's uid 1000 is greater than SYS_UID_MAX 999
114114
# We can safely ignore this warning, to get rid of the warning we could change /etc/login.defs but that does not seem worth it
115+
# We'll leave the home directory hardcoded to /stackable because I don't want to deal with which chars might be valid and which might not in user name vs. directory
115116
useradd \
116117
--no-log-init \
117118
--gid ${STACKABLE_USER_GID} \

0 commit comments

Comments
 (0)