commit
9e83b512ce
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -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;"]
|
10
README.md
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user