Merge pull request #3 from nickdlkk/main

chore: 构建容器
This commit is contained in:
York 2025-02-27 23:09:09 +08:00 committed by GitHub
commit 9e83b512ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 0 deletions

30
Dockerfile Normal file
View 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;"]

View File

@ -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