Skip to content

Conversation

@MoeRT09
Copy link

@MoeRT09 MoeRT09 commented Sep 3, 2024

It is considered bad practice to let applications run as root in a Docker container. Furthermore, this might even be prohibited in some environments. In order to lower the attack surface, the application is executed as an unprivileged user with this PR.

Copy link
Member

@JohannesRudolph JohannesRudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

ARG UID=1005

COPY --from=builder /build/build/libs/unipipe-service-broker-1.0.0.jar /app/
COPY --chown=0:0 --chmod=555 --from=builder /build/build/libs/unipipe-service-broker-1.0.0.jar /app/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the chown command in the COPY and in the RUN instruction below be combined into the COPY instruction already?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not really, the idea was that the jar is owned by root and can only be executed (not modified) by other users. While the /app itself must be writeable for the unprivileged container user, which runs the jar as it writes the SSH key into the /app/tmp directory (and also creates the /app/tmp directory after #139 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants