feat: 添加 Docker 支持 #34

This commit is contained in:
imsyy 2023-12-06 11:09:31 +08:00
parent 36c40b7870
commit b90c144a62
4 changed files with 51 additions and 1 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.github
.gitignore
README.md
LICENSE
.vscode
dist
build
images
script

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM node:16
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 6688
CMD ["npm", "start"]

View File

@ -68,6 +68,28 @@ pnpm install
pnpm start pnpm start
``` ```
## Docker 部署
> 安装及配置 Docker 将不在此处说明,请自行解决
### 本地构建
```bash
// 构建
docker build -t dailyhot-api .
// 运行
docker run -p 6688:6688 -d dailyhot-api
```
### 在线部署
```bash
// 拉取
docker pull imsyy/dailyhot-api:1.0.4
// 运行
docker run -p 6688:6688 -d imsyy/dailyhot-api:1.0.4
```
## Vercel 部署 ## Vercel 部署
现已支持 Vercel 部署,无需服务器 现已支持 Vercel 部署,无需服务器

View File

@ -1,6 +1,6 @@
{ {
"name": "dailyhot_api", "name": "dailyhot_api",
"version": "1.0.3", "version": "1.0.4",
"description": "一个今日热榜", "description": "一个今日热榜",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {