Skip to content

Commit 291adab

Browse files
committed
feat: Better docs
1 parent c59ed98 commit 291adab

File tree

3 files changed

+179
-5
lines changed

3 files changed

+179
-5
lines changed

.github/workflows/docker.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
jobs:
15+
build-amd64:
16+
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Login to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build and push (AMD64)
33+
uses: docker/build-push-action@v6
34+
with:
35+
platforms: linux/amd64
36+
context: .
37+
push: true
38+
tags: |
39+
ghcr.io/${{ github.repository }}:latest-amd
40+
ghcr.io/${{ github.repository }}:${{ github.sha }}-amd
41+
42+
build-arm64:
43+
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-arm64
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v3
51+
52+
- name: Login to GitHub Container Registry
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.repository_owner }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Build and push (ARM64)
60+
uses: docker/build-push-action@v6
61+
with:
62+
platforms: linux/arm64
63+
context: .
64+
push: true
65+
tags: |
66+
ghcr.io/${{ github.repository }}:latest-arm
67+
ghcr.io/${{ github.repository }}:${{ github.sha }}-arm
68+
69+
build-merge:
70+
runs-on: ubuntu-latest
71+
72+
needs:
73+
- build-amd64
74+
- build-arm64
75+
76+
steps:
77+
- name: Set up Docker Buildx
78+
uses: docker/setup-buildx-action@v3
79+
80+
- name: Login to GHCR
81+
uses: docker/login-action@v3
82+
with:
83+
registry: ghcr.io
84+
username: ${{ github.repository_owner }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
86+
87+
- name: Merge
88+
run: |
89+
docker buildx imagetools create -t ghcr.io/${{ github.repository }}:latest \
90+
ghcr.io/${{ github.repository }}:latest-amd \
91+
ghcr.io/${{ github.repository }}:latest-arm

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM oven/bun:1 AS builder
2+
WORKDIR /app
3+
4+
COPY package.json bun.lock ./
5+
RUN bun install --frozen-lockfile
6+
7+
COPY . .
8+
9+
# Compile the application into a single binary
10+
RUN bun build src/index.ts --compile --outfile server
11+
12+
# Use a lightweight base image for the final stage
13+
FROM debian:bookworm-slim
14+
WORKDIR /app
15+
16+
# Copy the compiled binary from the builder stage
17+
COPY --from=builder /app/server .
18+
19+
# Expose the default port
20+
EXPOSE 3000
21+
22+
CMD ["./server"]

README.md

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,76 @@
11
# rssfetch
22

3-
# Setup
3+
<p align="center">
4+
<img src="https://cdn.mikn.dev/branding/mikan-vtube.png" width="100">
5+
</p>
46

5-
Follow these steps to run [Elysia.js](https://elysiajs.com) under [Bun](https://bun.sh):
67

7-
1. Download packages
8+
A simple RSS feed fetcher and parser built with [Elysia.js](https://elysiajs.com) and [Bun](https://bun.sh).
9+
10+
A free instance is hosted at: [rssfetch.vercel.app](https://rssfetch.vercel.app). Feel free to use it!
11+
12+
## Deployment
13+
### Vercel
14+
- This project can be directly deployed to Vercel with no additional configuration needed.
15+
- Click the button below to deploy:
16+
17+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/mikndotdev/rssfetch)
18+
19+
### Cloudflare Workers
20+
- This project can also be deployed to Cloudflare Workers, but requires some manual setup.
21+
- Follow the instructions in the [Elysia Cloudflare Workers documentation](https://elysiajs.com/integrations/cloudflare-worker.html).
22+
23+
## Manual Setup
24+
25+
1. Install dependencies:
826
```bash
927
bun install
1028
```
11-
2. You're ready to go!
29+
30+
2. Start the server:
1231
```bash
13-
bun run main.ts
32+
bun start
1433
```
34+
The server will start on port 3000 by default.
35+
36+
## API Usage
37+
38+
### Fetch RSS Feed
39+
40+
**Endpoint:** `GET /`
41+
42+
**Query Parameters:**
43+
44+
| Parameter | Type | Required | Description | Default |
45+
|-----------|----------|----------|--------------------------------------------------|----------|
46+
| `url` | `string` | **Yes** | The URL of the RSS feed to fetch. | - |
47+
| `type` | `string` | No | Sort order for articles: `latest` or `oldest`. | `latest` |
48+
| `count` | `number` | No | The number of articles to return. | `1` |
49+
| `step` | `number` | No | The offset for pagination (items to skip). | `0` |
50+
51+
**Example Request:**
52+
53+
Fetch the latest 3 articles from an RSS feed:
54+
55+
```bash
56+
curl "http://localhost:3000/?url=https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml&count=3"
57+
```
58+
59+
**Example Response:**
1560

61+
```json
62+
{
63+
"title": "NYT > Top Stories",
64+
"description": "The New York Times: Top Stories",
65+
"link": "https://www.nytimes.com",
66+
"articles": [
67+
{
68+
"title": "Example Article Title",
69+
"link": "https://www.nytimes.com/2024/01/01/example.html",
70+
"description": "Brief description of the article content.",
71+
"pubDate": "Mon, 01 Jan 2024 12:00:00 GMT"
72+
}
73+
// ... 2 more articles
74+
]
75+
}
76+
```

0 commit comments

Comments
 (0)