From 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22 Mon Sep 17 00:00:00 2001 From: Shrikant upadhyay Date: Fri, 4 Nov 2022 15:29:35 +0530 Subject: [PATCH] Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user --- Dockerfile | 3 +++ README.md | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe0ee746..d6c156aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,4 +24,7 @@ RUN PATH="/usr/local/go/bin:${PATH}" \ FROM alpine:latest RUN apk add --update bash COPY --from=builder /usr/local/bin/razor /usr/local/bin/ +RUN set -x \ + && adduser -u 82 -D -S razor +USER razor ENTRYPOINT [ "razor" ] diff --git a/README.md b/README.md index e852bca0..5d600acb 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,19 @@ razor -v ## Docker quick start One of the quickest ways to get `razor-go` up and running on your machine is by using Docker: -``` -docker run -d -it--entrypoint /bin/sh --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:v1.0.1-incentivised-testnet-phase2 -``` + +1. Create user + ``` + useradd -u 82 razor + ``` +2. Start the container + ``` + docker run -d -it --entrypoint /bin/sh --name razor-go -v "$(echo $HOME)"/.razor:/home/razor/.razor razornetwork/razor-go:v1.0.1-incentivised-testnet-phase2 + ``` +3. Update the owner of `.razor` directory + ``` + chown razor:razor $HOME/.razor + ``` >**_NOTE:_** that we are leveraging docker bind-mounts to mount `.razor` directory so that we have a shared mount of `.razor` directory between the host and the container. The `.razor` directory holds keys to the addresses that we use in `razor-go`, along with logs and config. We do this to persist data in the host machine, otherwise you would lose your keys once you delete the container.