Last USER should not be root
35
36FROM alpine
37
38USER root39
40RUN apk update && apk add postgresql curl
41RUN mkdir /app
Description
Switching to the root USER
opens up certain security risks if an attacker gets access to the container. In order to mitigate this, switch back to a non privileged user after running the commands you need as root.
Bad Practice
FROM debian:buster
USER root
RUN ...
Recommended
FROM debian:buster
USER root
RUN ...
USER guest