Skip to content

Commit

Permalink
updated dockerfile and readme for non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrikant1212 committed Nov 4, 2022
1 parent 3376ea6 commit 0688ef7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
ENTRYPOINT [ "razor" ]
RUN set -x \
&& adduser -u 82 -D -S razor
USER razor
ENTRYPOINT [ "razor" ]
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,22 @@ One of the quickest ways to get `razor-go` up and running on your machine is by
```
docker network create razor_network
```
2. Create user
```
useradd -u 82 razor
```

2. Start razor-go container
3. Start razor-go container

```
docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:v1.0.0-mainnet
docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/home/razor/.razor razornetwork/razor-go:v1.0.0-mainnet
```

4. Update the owner of `.razor` directory
```
chown razor:razor $HOME/.razor
```

> **_NOTE:_** 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.
You need to set a provider before you can operate razor-go cli on docker:
Expand Down

0 comments on commit 0688ef7

Please sign in to comment.