Skip to content

Commit b21ec24

Browse files
committed
remove recursive chmod/chown from final image
1 parent b96184f commit b21ec24

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

druid/Dockerfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ COPY --chown=stackable:0 druid/stackable/patches/${PRODUCT} /stackable/apache-dr
4747
# are still working in the cache directory.
4848

4949
RUN --mount=type=cache,id=maven-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository \
50-
--mount=type=cache,id=npm-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.npm \
51-
--mount=type=cache,id=cache-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.cache \
52-
<<EOF
50+
--mount=type=cache,id=npm-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.npm \
51+
--mount=type=cache,id=cache-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.cache \
52+
<<EOF
5353
curl "https://repo.stackable.tech/repository/packages/druid/apache-druid-${PRODUCT}-src.tar.gz" | tar -xzC .
5454
cd apache-druid-${PRODUCT}-src
5555
./patches/apply_patches.sh ${PRODUCT}
@@ -58,6 +58,9 @@ mvn --batch-mode --no-transfer-progress clean install -Pdist,stackable-bundle-co
5858
mv distribution/target/apache-druid-${PRODUCT}-bin/apache-druid-${PRODUCT} /stackable/
5959
mv distribution/target/bom.json /stackable/apache-druid-${PRODUCT}/apache-druid-${PRODUCT}.cdx.json
6060
rm -rf /stackable/apache-druid-${PRODUCT}-src
61+
rm -rf /stackable/.m2
62+
63+
ln -s /stackable/apache-druid-${PRODUCT} /stackable/druid
6164

6265
# We're removing these to make the intermediate layer smaller
6366
# This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
@@ -74,6 +77,9 @@ fi
7477

7578
# Install OPA authorizer extension.
7679
curl "https://repo.stackable.tech/repository/packages/druid/druid-opa-authorizer-${AUTHORIZER}.tar.gz" | tar -xzC /stackable/apache-druid-${PRODUCT}/extensions
80+
81+
# change groups
82+
chmod -R g=u /stackable
7783
EOF
7884

7985
FROM stackable/image/java-base AS final
@@ -105,7 +111,8 @@ LABEL io.k8s.description="${DESCRIPTION}"
105111
LABEL io.k8s.display-name="${NAME}"
106112

107113

108-
COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/apache-druid-${PRODUCT} /stackable/apache-druid-${PRODUCT}
114+
COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable /stackable
115+
109116
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/bin /stackable/bin
110117
COPY --chown=${STACKABLE_USER_UID}:0 druid/licenses /licenses
111118

@@ -115,19 +122,13 @@ microdnf clean all
115122
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | sort > /stackable/package_manifest.txt
116123
rm -rf /var/cache/yum
117124

118-
ln -s /stackable/apache-druid-${PRODUCT} /stackable/druid
119-
125+
chmod g=u /stackable/bin/run-druid
120126
# Force to overwrite the existing 'run-druid'
121127
ln -sf /stackable/bin/run-druid /stackable/druid/bin/run-druid
122-
123-
# All files and folders owned by root group to support running as arbitrary users.
124-
# This is best practice as all container users will belong to the root group (0).
125-
chown -R ${STACKABLE_USER_UID}:0 /stackable
126-
chmod -R g=u /stackable
127128
EOF
128129

129130
# ----------------------------------------
130-
# Attention: We are changing the group of all files in /stackable directly above
131+
# Attention:
131132
# If you do any file based actions (copying / creating etc.) below this comment you
132133
# absolutely need to make sure that the correct permissions are applied!
133134
# chown ${STACKABLE_USER_UID}:0

0 commit comments

Comments
 (0)