From e84099ee6fdca2a95d5cad592459fecba3312a51 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 26 Feb 2025 21:11:37 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9E=84=E5=BB=BA=E5=AE=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 30 ++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f938f73 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ + +# 构建阶段 +FROM node:18-alpine as builder + +# 设置工作目录 +WORKDIR /app + +# 复制 package.json 和 package-lock.json +COPY package*.json ./ + +# 安装依赖 +RUN npm install + +# 复制源代码 +COPY . . + +# 构建项目 +RUN npm run build + +# 生产环境阶段 +FROM nginx:alpine + +# 复制构建产物到 Nginx 目录 +COPY --from=builder /app/dist /usr/share/nginx/html + +# 暴露 80 端口 +EXPOSE 80 + +# 启动 Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/README.md b/README.md index 206e79f..dd0d03d 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,16 @@ This is a frontend-only application that can be easily deployed to various stati After the program is deployed, Vercel will provide an accessible domain name. The default domain name is usually not accessible in mainland China, and you can solve this problem by binding your own domain name. +## Docker 部署 | Docker Deployment + +```bash +# build image 构建镜像 +docker build -t dick-helper . + +# run container 运行容器 +docker run -p 80:80 dick-helper +``` + ## 技术栈 | Tech Stack - React 19.0.0