Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git
.github
*.md
*.png
*.jpg
*.jpeg
*.gif

# Local Config
config/

# Local outputs
data/
dist/
bin/

# Editor/OS
.DS_Store
.idea/
.vscode/
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1.22-alpine AS builder

RUN apk add --no-cache ca-certificates git
WORKDIR /src

# Better layer caching
COPY go.mod go.sum ./
RUN go mod download

COPY . .

# Build a static-ish binary
ENV CGO_ENABLED=0
RUN go build -trimpath -ldflags="-s -w" -o /out/matcha .

FROM alpine:3.20

# HTTPS calls (RSS feeds, OpenAI/LocalAI, etc.) need CA certs
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -S matcha && adduser -S matcha -G matcha

WORKDIR /app
COPY --from=builder /out/matcha /usr/local/bin/matcha

# Conventional mount points
RUN mkdir -p /config /data && chown -R matcha:matcha /config /data
USER matcha

# Default: run once using a mounted config
ENTRYPOINT ["matcha"]
CMD ["-c", "/config/config.yaml"]
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,62 @@ Run matcha with --help option to see current cli options:

#### OPML Import
To use OPML files (exported from other services), rename your file to `config.opml` and leave it in the directory where matcha is located. The other option is to run the command with -o option pointing to the opml filepath.


### Docker

Build

```sh
docker build -t matcha:local .
```

Prepare the folder for the config that holds your `config.yaml` file and data folder for the markdown output and persistence.

Ensure your `config.yaml` sets `markdown_dir_path: /data/markdown` (and optionally `database_file_path: /data/matcha.db`).

```sh
mkdir -p config data/markdown
```

Run

```sh
docker run --rm \
-v "$PWD/config:/config:ro" \
-v "$PWD/data:/data" \
matcha:local \
-c /config/config.yaml
```

Run in terminal mode (-t)

```sh
docker run --rm \
-v "$PWD/config:/config:ro" \
-v "$PWD/data:/data" \
matcha:local \
-c /config/config.yaml -t
```

For more frequent runs and updates run the docker-compose file:

Run once

```sh
docker compose run --rm matcha-once
```

Run once with -t

```sh
docker compose run --rm matcha-once -c /config/config.yaml -t
```

Run scheduled

```sh
docker compose up -d matcha-scheduled
docker compose logs -f matcha-scheduled
```

21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
matcha-once:
build: .
container_name: matcha-once
volumes:
- ./config:/config:ro
- ./data:/data
command: ["-c", "/config/config.yaml"]

matcha-scheduled:
build: .
container_name: matcha-scheduled
volumes:
- ./config:/config:ro
- ./data:/data
environment:
MATCHA_INTERVAL_SECONDS: "3600"
entrypoint: ["/bin/sh", "-lc"]
command:
- 'while true; do matcha -c /config/config.yaml || true; sleep "$${MATCHA_INTERVAL_SECONDS}"; done'
restart: unless-stopped