Skip to content

Commit

Permalink
Add Dockerfile and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlusky committed Nov 21, 2023
1 parent b04261a commit 1022775
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.21.4 AS Build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
COPY cmd ./cmd
COPY pkg ./pkg
RUN CGO_ENABLED=0 GOOS=linux go build -o /gpodder2go

FROM alpine:3.18.4
RUN mkdir /data
WORKDIR /data
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /data
COPY --from=Build /gpodder2go /gpodder2go
EXPOSE 3005
VOLUME /data
CMD ["/entrypoint.sh"]
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,31 @@ Add with:
```
# eselect repository add seiga git https://github.com/seigakaku/gentoo_ebuilds
```

### Docker

Build with:

```
$ git clone https://github.com/oxtyped/gpodder2go
$ cd gpodder2go
$ docker build -t oxtyped/gpodder2go .
```

Run with:

```
$ docker run --rm -it -p 3005:3005 oxtyped/gpodder2go
```

For persistent data, you can map `/data` as a volume:

```
$ docker run --rm -it -v /gpodder2go_data:/data -p 3005:3005 oxtyped/gpodder2go
```

To add a user:

```
$ docker run --rm -it -v /gpodder2go_data:/data oxtyped/gpodder2go /gpodder2go accounts create <username> --email="<email>" --name="<display_name>" --password="<password>"
```
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
if [ ! -f "/data/g2g.db" ]; then
echo "No database found, intializing gpodder2go ..."
/gpodder2go init
echo "... database initialized"
fi
if [ ! -f "/data/VERIFIER_SECRET_KEY" ]; then
echo "VERIFIER_SECRET_KEY not found, intializing VERIFIER_SECRET_KEY ..."
cat /dev/urandom | head -c 30 | base64 > /data/VERIFIER_SECRET_KEY
echo "... VERIFIER_SECRET_KEY initialized"
fi
VERIFIER_SECRET_KEY="$(cat /data/VERIFIER_SECRET_KEY)" /gpodder2go serve --addr "${ADDR:-0.0.0.0:3005}"

0 comments on commit 1022775

Please sign in to comment.