-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pengmao
committed
Apr 19, 2024
1 parent
426f4c7
commit 8f0136d
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.temp | ||
cache | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 使用 Node.js 官方提供的 Node 镜像作为基础镜像来构建项目 | ||
FROM node:14-alpine AS build | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 复制 package.json 和 package-lock.json 文件到工作目录 | ||
COPY package*.json ./ | ||
|
||
# 安装依赖 | ||
RUN npm install | ||
|
||
# 复制所有文件到工作目录 | ||
COPY . . | ||
|
||
# 构建项目 | ||
RUN npm run docs:build | ||
|
||
# 使用 Nginx 官方提供的 Nginx 镜像作为基础镜像 | ||
FROM nginx:alpine | ||
|
||
# 将构建后的项目文件复制到 Nginx 默认的静态文件目录 | ||
COPY --from=build /app/docs/.vitepress/dist /usr/share/nginx/html | ||
|
||
# 暴露 Nginx 的默认端口 | ||
EXPOSE 80 | ||
|
||
# 启动 Nginx | ||
CMD ["nginx", "-g", "daemon off;"] |