Skip to content

Commit

Permalink
fix: Run as non root and adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dadav committed Jul 2, 2024
1 parent cc7789f commit e71e5df
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM ubuntu:latest as user_stage
RUN useradd -u 10001 gorge

FROM scratch
ENV HOME /home/gorge
USER 10001
FROM alpine:3.20
RUN adduser -k /dev/null -u 10001 -D gorge \
&& chgrp 0 /home/gorge \
&& chmod -R g+rwX /home/gorge
COPY gorge /
COPY --from=user_stage /etc/passwd /etc/passwd
USER 10001
VOLUME [ "/home/gorge" ]
ENTRYPOINT ["/gorge"]
CMD ["serve"]
CMD [ "serve" ]
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,43 @@ Via `go install`:
go install github.com/dadav/gorge@latest
```

Via `tarball`:

```bash
wget https://github.com/dadav/gorge/releases/download/0.4.2-alpha/gorge_0.4.2-alpha_Linux_x86_64.tar.gz
sudo tar xf gorge_0.4.2-alpha_Linux_x86_64.tar.gz -C /usr/local/bin/ gorge
```

Via `container image`:

```bash
podman run --rm -p 8080:8080 ghcr.io/dadav/gorge:latest
```

Via various package types:

```bash
# rpm
wget https://github.com/dadav/gorge/releases/download/0.4.2-alpha/gorge_0.4.2-alpha_linux_amd64.rpm
sudo yum localinstall gorge_0.4.2-alpha_linux_amd64.rpm

# deb
wget https://github.com/dadav/gorge/releases/download/0.4.2-alpha/gorge_0.4.2-alpha_linux_amd64.deb
sudo apt install gorge_0.4.2-alpha_linux_amd64.deb

# apk
wget https://github.com/dadav/gorge/releases/download/0.4.2-alpha/gorge_0.4.2-alpha_linux_amd64.apk
sudo apk add --allow-untrusted gorge_0.4.2-alpha_linux_amd64.apk
```

Via `helm`:

```bash
git clone https://github.com/dadav/gorge.git
cd gorge/helm/gorge
helm install --namespace gorge --create-namespace gorge .
```

## 💎 Usage

```bash
Expand Down Expand Up @@ -71,6 +108,23 @@ Global Flags:
--config string config file (default is $HOME/.gorge.yaml)
```
### ⛳ Autostart
You can use [gorge.service](./gorge.service) to integrate gorge into your systemd autostart.
The required steps are:
```bash
wget https://raw.githubusercontent.com/dadav/gorge/main/gorge.service
wget https://raw.githubusercontent.com/dadav/gorge/main/defaults.yaml
sudo mv gorge.service /etc/systemd/system/gorge.service
sudo mv defaults.yaml /etc/gorge.yaml
sudo systemctl daemon-reload
sudo systemctl enable --now gorge.service
```
If you've installed gorge as a package (rpm, deb, apk), the required files should already be there.

## 🐂 Examples

```bash
Expand Down

0 comments on commit e71e5df

Please sign in to comment.