Skip to content

Commit

Permalink
Docker file added multistage build to add non-root user running under…
Browse files Browse the repository at this point in the history
… ID:20001 for image.

Reduces attack surface by not running image as root user
  • Loading branch information
Janis Orlovs authored and wrouesnel committed Jul 3, 2019
1 parent 85c3152 commit 0678110
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM debian:7.11-slim
RUN useradd -u 20001 postgres_exporter

FROM scratch

COPY --from=0 /etc/passwd /etc/passwd
USER postgres_exporter

ARG binary

COPY $binary /postgres_exporter
Expand Down

0 comments on commit 0678110

Please sign in to comment.