-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
28 additions
and
6 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
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,26 @@ | ||
# 使用官方的 node 镜像作为基础镜像 | ||
FROM node:14 | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 复制 package.json 和 package-lock.json 以安装依赖 | ||
COPY package*.json ./ | ||
|
||
# 安装项目依赖 | ||
RUN npm install | ||
|
||
# 复制应用程序的源代码到容器中 | ||
COPY . . | ||
|
||
# 构建 React 应用 | ||
RUN npm run build | ||
|
||
# 使用 serve 来提供构建后的应用,端口号可以是 3000 或者任何你想要的端口 | ||
RUN npm install -g serve | ||
|
||
# 暴露端口 3000 | ||
EXPOSE 3000 | ||
|
||
# 启动应用 | ||
CMD ["serve", "-s", "build", "-l", "3000"] |
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