Skip to content

Commit cc3012c

Browse files
committed
引入Docker
1 parent de8a41e commit cc3012c

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.next*

Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG NOTION_PAGE_ID
2+
# Install dependencies only when needed
3+
FROM node:14-alpine AS deps
4+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
5+
RUN apk add --no-cache libc6-compat
6+
WORKDIR /app
7+
COPY package.json yarn.lock ./
8+
RUN yarn install --frozen-lockfile
9+
10+
# Rebuild the source code only when needed
11+
FROM node:14-alpine AS builder
12+
ARG NOTION_PAGE_ID
13+
WORKDIR /app
14+
COPY --from=deps /app/node_modules ./node_modules
15+
COPY . .
16+
RUN yarn build
17+
18+
ENV NODE_ENV production
19+
20+
EXPOSE 3000
21+
22+
# Next.js collects completely anonymous telemetry data about general usage.
23+
# Learn more here: https://nextjs.org/telemetry
24+
# Uncomment the following line in case you want to disable telemetry.
25+
# ENV NEXT_TELEMETRY_DISABLED 1
26+
27+
CMD ["yarn", "start"]

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272

7373
## 快速开发
7474

75+
- 通过Docker体验本地部署
76+
```bash
77+
docker build -t notionnext .
78+
docker run -p 3000:3000 notionnext
79+
```
80+
81+
- 本地安装Nodejs进行开发
7582
```bash
7683
yarn # 安装依赖
7784
yarn run dev # 本地开发

0 commit comments

Comments
 (0)