From cc3012c99997ad780c22bb4ebedaddfa639c31ee Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 23 Mar 2022 14:56:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BC=95=E5=85=A5Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 + Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 7 +++++++ 3 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..d8f03724 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.next* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7f377d3c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +ARG NOTION_PAGE_ID +# Install dependencies only when needed +FROM node:14-alpine AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +# Rebuild the source code only when needed +FROM node:14-alpine AS builder +ARG NOTION_PAGE_ID +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN yarn build + +ENV NODE_ENV production + +EXPOSE 3000 + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry. +# ENV NEXT_TELEMETRY_DISABLED 1 + +CMD ["yarn", "start"] \ No newline at end of file diff --git a/README.md b/README.md index 5f91f648..fed5349b 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,13 @@ ## 快速开发 +- 通过Docker体验本地部署 +```bash +docker build -t notionnext . +docker run -p 3000:3000 notionnext +``` + +- 本地安装Nodejs进行开发 ```bash yarn # 安装依赖 yarn run dev # 本地开发 From 925f458e2b3f08ee51e63e888929b75491562ded Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 23 Mar 2022 15:27:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?docker=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fed5349b..5b37f1c5 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,15 @@ - 通过Docker体验本地部署 ```bash -docker build -t notionnext . -docker run -p 3000:3000 notionnext +# 从Dockerhub残酷中直接下载体验 +docker run -p 3000:3000 tangly1024/notionnext:2.8.1 + +# 或本地编译 +docker build -t notionnext . # 编译镜像 +docker run -p 3000:3000 notionnext # 启动演示镜像 + +# 切换成你的notion数据 +docker run -p 3000:3000 -e NOTION_PAGE_ID="你的Notion_Page_ID" tangly1024/notionnext:2.8.1 ``` - 本地安装Nodejs进行开发 From b7fee9fd12999090f1618f5dfcbbab780f6b4722 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 23 Mar 2022 15:34:47 +0800 Subject: [PATCH 3/3] docker README.md --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5b37f1c5..3ddc5005 100644 --- a/README.md +++ b/README.md @@ -74,15 +74,12 @@ - 通过Docker体验本地部署 ```bash -# 从Dockerhub残酷中直接下载体验 +# 从Dockerhub仓库中下载体验 +docker pull tangly1024/notionnext:2.8.1 docker run -p 3000:3000 tangly1024/notionnext:2.8.1 - -# 或本地编译 -docker build -t notionnext . # 编译镜像 -docker run -p 3000:3000 notionnext # 启动演示镜像 - -# 切换成你的notion数据 +# 可以在环境变量中直接配置NOTION_PAGE_ID docker run -p 3000:3000 -e NOTION_PAGE_ID="你的Notion_Page_ID" tangly1024/notionnext:2.8.1 + ``` - 本地安装Nodejs进行开发