Skip to content
Snippets Groups Projects
Commit 11f8a731 authored by Mikhail Piatliou (EPAM)'s avatar Mikhail Piatliou (EPAM)
Browse files

Merge branch 'GONRG-7392-non-root-images' into 'master'

GONRG-7392: use non-root user for images

See merge request !404
parents 073b9253 553eaab3
No related branches found
No related tags found
1 merge request!404GONRG-7392: use non-root user for images
Pipeline #195975 failed
......@@ -38,7 +38,7 @@ spec:
{{- end }}
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
runAsNonRoot: true
ports:
- containerPort: 8080
resources:
......
......@@ -6,5 +6,10 @@ ARG PORT
ENV PORT $PORT
# Copy the jar to the production image from the builder stage.
COPY provider/notification-${PROVIDER_NAME}/target/notification-${PROVIDER_NAME}-*-spring-boot.jar notification-${PROVIDER_NAME}.jar
# Add a non-root user
RUN groupadd -g 10001 -r nonroot \
&& useradd -g 10001 -r -u 10001 nonroot
# Run as non-root user
USER 10001:10001
# Run the web service on container startup.
CMD java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${PORT} -Dlog4j.formatMsgNoLookups=true -jar /app/notification-${PROVIDER_NAME}.jar
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment