Skip to content

Commit 35abeb4

Browse files
committed
Adjust Hello-World
1 parent 922f420 commit 35abeb4

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

hello-world/Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM stackable/image/java-base
44

55
ARG PRODUCT
66
ARG RELEASE
7+
ARG STACKABLE_USER_UID
78

89
LABEL name="Hello World" \
910
maintainer="info@stackable.tech" \
@@ -13,13 +14,20 @@ LABEL name="Hello World" \
1314
summary="The Stackable image for the Stackable Hello World Operator" \
1415
description="This image is deployed by the Stackable Hello World Operator."
1516

16-
RUN microdnf update && \
17-
microdnf clean all && \
18-
rm -rf /var/cache/yum
17+
RUN <<EOF
18+
microdnf update
19+
microdnf clean all
20+
rm -rf /var/cache/yum
1921

20-
USER stackable
21-
WORKDIR /stackable
22+
curl --fail -L https://repo.stackable.tech/repository/packages/hello-world/hello-world-${PRODUCT}.jar -o /stackable/hello-world.jar
23+
24+
# All files and folders owned by root to support running as arbitrary users
25+
# This is best practice as all container users will belong to the root group (0)
26+
chown -R ${STACKABLE_USER_UID}:0 /stackable
27+
chmod -R g=u /stackable
28+
EOF
2229

23-
RUN curl --fail -L https://repo.stackable.tech/repository/packages/hello-world/hello-world-${PRODUCT}.jar -o hello-world.jar
30+
USER ${STACKABLE_USER_UID}
31+
WORKDIR /stackable
2432

2533
CMD ["java", "-jar", "hello-world.jar"]

0 commit comments

Comments
 (0)