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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM node:24-alpine AS builder

WORKDIR /app

RUN apk add --no-cache python3 make g++

COPY package*.json ./
RUN npm ci

COPY . .

RUN npm run build:local

RUN npm prune --omit=dev

FROM node:24-alpine

WORKDIR /app

RUN apk add --no-cache python3

COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist

RUN mv ./dist/server.cjs ./server.cjs

EXPOSE 8787

ENV PORT=8787
ENV DB_PATH=/nodewarden/db.sqlite
ENV LOCAL_ATTACHMENTS_DIR=/nodewarden/attachments

CMD ["node", "server.cjs"]
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,27 @@ English: [`README_EN.md`](./README_EN.md)



## CLI 部署
## Docker 部署 (私有化部署)

如果你希望在本地私有环境(非 Cloudflare)运行,可以通过 Docker 快速部署:

1. **环境准备**
新建一个用于存放数据的目录(例如 `nodewarden-data`),下载并创建 [`docker-compose.yml`](./docker-compose.yml) 文件。

2. **配置秘钥**
编辑 `docker-compose.yml`,修改传入的 `JWT_SECRET` 为你自己生成的一个长随机字符串(至少 32 位)。

3. **启动服务**
```bash
docker-compose up -d
```
启动后,访问 `http://localhost:8787` 即可开始使用。

> [!NOTE]
> 基于 Docker 的本地部署使用本机自带的文件系统目录(`/nodewarden/attachments`)替代了 R2 对象存储,使用 SQLite(`/nodewarden/db.sqlite`)替代了 D1 数据库,所有数据均保留在本地映射的数据卷中。


## CLI 部署 (Cloudflare)

```powershell
git clone https://github.com/shuaiplus/NodeWarden.git
Expand Down
21 changes: 20 additions & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,26 @@
> - Manual: open your fork on GitHub, click `Sync fork`, then `Update branch`
> - Automatic: go to your fork -> `Actions` -> `Sync upstream` -> `Enable workflow`; it will sync upstream automatically every day at 3 AM

## CLI Deploy
## Docker Deploy (Self-Hosted)

If you wish to run NodeWarden in your private environment (outside Cloudflare), you can easily deploy it using Docker:

1. **Setup**
Create a new directory for your data (e.g. `nodewarden-data`), and create a [`docker-compose.yml`](./docker-compose.yml) file.

2. **Configure Secrets**
Edit `docker-compose.yml` to change the `JWT_SECRET` environment variable to your own securely generated random string (at least 32 characters in length).

3. **Start the Service**
```bash
docker-compose up -d
```
After starting, open `http://localhost:8787` in your browser.

> [!NOTE]
> The local Docker deployment uses the local filesystem (`/nodewarden/attachments`) instead of R2 object storage, and SQLite (`/nodewarden/db.sqlite`) instead of a D1 Database. All your data stays secured locally via the configured Docker volume mount.

## CLI Deploy (Cloudflare)

```powershell
git clone https://github.com/shuaiplus/NodeWarden.git
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
nodewarden:
build: .
# image: shuaiplus/nodewarden:latest # Alternatively, use pre-built image if available
container_name: nodewarden
restart: unless-stopped
ports:
- "8787:8787"
environment:
- JWT_SECRET=YOUR_SECURE_RANDOM_SECRET_KEY_HERE_MIN_32_CHARS
volumes:
- ./data:/nodewarden
Loading