Skip to content
Snippets Groups Projects
Commit 59d71531 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 !573
parents c6ce3250 a60bae05
No related branches found
No related tags found
1 merge request!573GONRG-7392: use non-root user for images
Pipeline #195974 failed
......@@ -49,7 +49,7 @@ spec:
{{- end }}
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
runAsNonRoot: true
ports:
- containerPort: 8080
resources:
......
FROM azul/zulu-openjdk:8-latest
WORKDIR /app
ARG PROVIDER_NAME
ENV PROVIDER_NAME $PROVIDER_NAME
ARG PORT
ENV PORT $PORT
# Copy the jar to the production image from the builder stage.
COPY provider/indexer-${PROVIDER_NAME}/target/indexer-${PROVIDER_NAME}-*-spring-boot.jar indexer-${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=indexer:/dev/./urandom -Dserver.port=${PORT} -Dlog4j.formatMsgNoLookups=true -jar /app/indexer-${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