From b90c144a6278dc07bda7f135decc8996b0e7f471 Mon Sep 17 00:00:00 2001 From: imsyy Date: Wed, 6 Dec 2023 11:09:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Docker=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20#34?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 15 +++++++++++++++ Dockerfile | 13 +++++++++++++ README.md | 22 ++++++++++++++++++++++ package.json | 2 +- 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2810f83 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.github +.gitignore +README.md +LICENSE +.vscode +dist +build +images +script \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..09a5181 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:16 + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +EXPOSE 6688 + +CMD ["npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index f67739a..b0ef88a 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,28 @@ pnpm install 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 部署,无需服务器 diff --git a/package.json b/package.json index b89c37a..0405225 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dailyhot_api", - "version": "1.0.3", + "version": "1.0.4", "description": "一个今日热榜", "main": "index.js", "scripts": {