update
This commit is contained in:
parent
f2cc6e0b78
commit
4408899e97
39
.dockerignore
Normal file
39
.dockerignore
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# 版本控制系统
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# 依赖目录
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
|
||||||
|
# 环境文件
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# 日志文件
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# 编辑器目录和文件
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
# 操作系统文件
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# 测试覆盖率目录
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# 其他不需要的文件
|
||||||
|
README.md
|
||||||
|
LICENSE
|
||||||
|
docker-compose.yml
|
||||||
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# 构建阶段
|
||||||
|
FROM node:20-alpine as build-stage
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 设置 npm 淘宝镜像源
|
||||||
|
RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
|
||||||
|
|
||||||
|
# 复制package.json和package-lock.json
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# 复制所有源代码
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 构建应用
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# 生产阶段
|
||||||
|
FROM nginx:stable-alpine as production-stage
|
||||||
|
|
||||||
|
# 从构建阶段复制构建好的文件到nginx目录
|
||||||
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# 暴露80端口
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# 启动nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
77
README.md
77
README.md
@ -1,64 +1,101 @@
|
|||||||
# .
|
# icrypto.work
|
||||||
|
|
||||||
This template should help get you started developing with Vue 3 in Vite.
|
这是一个加密货币AI服务平台,基于Vue 3和Vite开发。
|
||||||
|
|
||||||
## Recommended IDE Setup
|
## 推荐的IDE设置
|
||||||
|
|
||||||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (并禁用Vetur)。
|
||||||
|
|
||||||
## Type Support for `.vue` Imports in TS
|
## `.vue`导入的TypeScript支持
|
||||||
|
|
||||||
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
|
TypeScript默认无法处理`.vue`导入的类型信息,因此我们用`vue-tsc`替换`tsc` CLI进行类型检查。在编辑器中,我们需要[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)使TypeScript语言服务识别`.vue`类型。
|
||||||
|
|
||||||
## Customize configuration
|
## 自定义配置
|
||||||
|
|
||||||
See [Vite Configuration Reference](https://vite.dev/config/).
|
参见[Vite配置参考](https://vite.dev/config/)。
|
||||||
|
|
||||||
## Project Setup
|
## 项目设置
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compile and Hot-Reload for Development
|
### 开发环境编译和热重载
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Type-Check, Compile and Minify for Production
|
### 类型检查、编译和生产环境构建
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
### 使用[Vitest](https://vitest.dev/)运行单元测试
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run test:unit
|
npm run test:unit
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run End-to-End Tests with [Playwright](https://playwright.dev)
|
### 使用[Playwright](https://playwright.dev)运行端到端测试
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Install browsers for the first run
|
# 首次运行安装浏览器
|
||||||
npx playwright install
|
npx playwright install
|
||||||
|
|
||||||
# When testing on CI, must build the project first
|
# 在CI上测试时,必须先构建项目
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
# Runs the end-to-end tests
|
# 运行端到端测试
|
||||||
npm run test:e2e
|
npm run test:e2e
|
||||||
# Runs the tests only on Chromium
|
# 仅在Chromium上运行测试
|
||||||
npm run test:e2e -- --project=chromium
|
npm run test:e2e -- --project=chromium
|
||||||
# Runs the tests of a specific file
|
# 运行特定文件的测试
|
||||||
npm run test:e2e -- tests/example.spec.ts
|
npm run test:e2e -- tests/example.spec.ts
|
||||||
# Runs the tests in debug mode
|
# 在调试模式下运行测试
|
||||||
npm run test:e2e -- --debug
|
npm run test:e2e -- --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
### Lint with [ESLint](https://eslint.org/)
|
### 使用[ESLint](https://eslint.org/)进行代码检查
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run lint
|
npm run lint
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docker部署
|
||||||
|
|
||||||
|
本项目支持Docker部署,包含以下文件:
|
||||||
|
|
||||||
|
- `Dockerfile` - 多阶段构建配置
|
||||||
|
- `.dockerignore` - 排除不需要的文件
|
||||||
|
- `docker-compose.yml` - 简化部署配置
|
||||||
|
- `nginx.conf` - Nginx优化配置
|
||||||
|
|
||||||
|
### 使用Docker构建和运行
|
||||||
|
|
||||||
|
构建Docker镜像:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t icrypto-web .
|
||||||
|
```
|
||||||
|
|
||||||
|
运行容器:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -p 80:80 icrypto-web
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用Docker Compose部署
|
||||||
|
|
||||||
|
一键构建和部署:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
停止服务:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|||||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
32
nginx.conf
Normal file
32
nginx.conf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 缓存静态资源
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
expires 30d;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 压缩文本文件提高性能
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_min_length 10240;
|
||||||
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript;
|
||||||
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
|
||||||
|
# 处理错误页面
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user