Skip to content

Commit a8d57f6

Browse files
committed
Run the Java Docker test as a non-root user
This ensures we're correctly covering the permissions configuration of the injected overrides files.
1 parent 9fd4a67 commit a8d57f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/fixtures/docker/java/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ FROM openjdk:16-alpine3.13
33
RUN mkdir -p /usr/src/app
44
WORKDIR /usr/src/app
55

6+
# We run the app with a non-root user, because this is a common pattern especially
7+
# in Java apps, and we need to ensure the injected file permissions support it:
8+
RUN adduser --uid 5000 -D appuser && chown -R appuser /usr/src/app
9+
USER appuser
10+
611
COPY . .
712

813
RUN javac Main.java

0 commit comments

Comments
 (0)