Skip to content

Commit 7f95edb

Browse files
authored
Updated user in dockerfile (#1012)
* updating user in dockerfile * updating readme for non-root user
1 parent e64b3bd commit 7f95edb

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ RUN PATH="/usr/local/go/bin:${PATH}" \
2424
FROM alpine:latest
2525
RUN apk add --update bash
2626
COPY --from=builder /usr/local/bin/razor /usr/local/bin/
27+
RUN set -x \
28+
&& adduser -u 82 -D -S razor
29+
USER razor
2730
ENTRYPOINT [ "razor" ]

README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@ razor -v
3131
## Docker quick start
3232

3333
One of the quickest ways to get `razor-go` up and running on your machine is by using Docker:
34-
```
35-
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
36-
```
34+
35+
1. Create user
36+
```
37+
useradd -u 82 razor
38+
```
39+
2. Start the container
40+
```
41+
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
42+
```
43+
3. Update the owner of `.razor` directory
44+
```
45+
chown razor:razor $HOME/.razor
46+
```
3747
3848
>**_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.
3949

0 commit comments

Comments
 (0)