Dockerfile: use non-privileged user account (#16052)

This commit is contained in:
Federico Gimenez 2018-04-05 14:14:32 +02:00 committed by Felix Lange
parent ec8ee611ca
commit 50dbe8e244
2 changed files with 12 additions and 0 deletions

@ -12,5 +12,11 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/ COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
RUN addgroup -g 1000 geth && \
adduser -h /root -D -u 1000 -G geth geth && \
chown geth:geth /root
USER geth
EXPOSE 8545 8546 30303 30303/udp 30304/udp EXPOSE 8545 8546 30303 30303/udp 30304/udp
ENTRYPOINT ["geth"] ENTRYPOINT ["geth"]

@ -12,4 +12,10 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/ COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
RUN addgroup -g 1000 geth && \
adduser -h /root -D -u 1000 -G geth geth \
chown geth:geth /root
USER geth
EXPOSE 8545 8546 30303 30303/udp 30304/udp EXPOSE 8545 8546 30303 30303/udp 30304/udp