Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf-front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yuzhenWang
yd-csf-front
Commits
e4e2e272
Commit
e4e2e272
authored
Sep 17, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置
parent
daff13a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
1 deletions
+105
-1
.env.development
+1
-1
Dockerfile
+64
-0
nginx.conf
+38
-0
package.json
+2
-0
No files found.
.env.development
View file @
e4e2e272
...
...
@@ -6,5 +6,5 @@ VITE_APP_ENV = 'development'
# 测试前缀 接口前缀 暂时是这个
VITE_APP_BASE_API = 'http://139.224.145.34:9002'
# 测试环境地址前缀 暂时是这个
# 测试环境地址前缀 暂时是这个
,退出系统用到
VITE_APP_BASE_API1 = 'http://139.224.145.34:6699'
Dockerfile
0 → 100644
View file @
e4e2e272
# 使用 Node.js 18 基础镜像 (Debian bullseye)
FROM
docker.m.daocloud.io/library/node:18-bullseye AS build
# 设置环境变量
ENV
npm_config_canvas_binary_host_mirror="https://npmmirror.com/mirrors/canvas"
ENV
npm_config_sharp_binary_host="https://npmmirror.com/mirrors/sharp"
ENV
npm_config_sharp_libvips_binary_host="https://npmmirror.com/mirrors/sharp-libvips"
# 添加 esbuild 镜像源
ENV
ESBUILD_BINARY_HOST="https://npmmirror.com/mirrors/esbuild"
# 安装系统依赖 (使用阿里云镜像源)
RUN
sed
-i
's/deb.debian.org/mirrors.aliyun.com/g'
/etc/apt/sources.list
&&
\
sed
-i
's/security.debian.org/mirrors.aliyun.com/g'
/etc/apt/sources.list
&&
\
apt-get update
&&
apt-get install
-y
--no-install-recommends
\
build-essential
\
python3
\
pkg-config
\
libcairo2-dev
\
libpango1.0-dev
\
libjpeg-dev
\
libgif-dev
\
librsvg2-dev
\
libvips-dev
\
&&
rm
-rf
/var/lib/apt/lists/
*
# 设置工作目录
WORKDIR
/app
# 复制包管理文件
COPY
package.json ./
# 1. 显式安装 esbuild 二进制
RUN
npm install @esbuild/linux-x64
--verbose
--registry
=
https://registry.npmmirror.com
# 2. 安装其他原生模块
RUN
npm install canvas@2.11.2
--verbose
--ignore-scripts
RUN
npm install sharp@0.32.6
--verbose
--ignore-scripts
# 3. 安装项目依赖(移除 --no-optional)
RUN
npm install
--verbose
--registry
=
https://registry.npmmirror.com
# 4. 验证 esbuild 安装
RUN
ls
-la
node_modules/esbuild/bin
&&
\
./node_modules/.bin/esbuild
--version
# 复制源码并构建
COPY
. .
RUN
npm run build:dev
# 生产阶段
FROM
docker.m.daocloud.io/library/nginx:alpine
COPY
--from=build /app/dist /usr/share/nginx/html
COPY
nginx.conf /etc/nginx/conf.d/default.conf
# 设置时区
RUN
echo
"https://mirrors.aliyun.com/alpine/v3.22/main/"
>
/etc/apk/repositories
&&
\
echo
"https://mirrors.aliyun.com/alpine/v3.22/community/"
>>
/etc/apk/repositories
&&
\
apk update
&&
\
apk add
--no-cache
tzdata
&&
\
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&&
\
echo
"Asia/Shanghai"
>
/etc/timezone
EXPOSE
6688
CMD
["nginx", "-g", "daemon off;"]
nginx.conf
0 → 100644
View file @
e4e2e272
server
{
listen
6688
;
server_name
139
.224.145.34
;
# 处理前端静态资源(Vue应用)
location
/
{
root
/usr/share/nginx/html
;
index
index.html
;
try_files
$uri
$uri
/
/index.html
;
# 处理Vue路由history模式
if
(
$request_method
=
OPTIONS)
{
add_header
'Access-Control-Allow-Origin'
'*'
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
;
add_header
'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'
;
add_header
'Access-Control-Max-Age'
1728000
;
add_header
'Content-Type'
'text/plain
charset=UTF-8'
;
add_header
'Content-Length'
0
;
return
204
;
}
limit_except
GET
POST
PUT
DELETE
OPTIONS
{
deny
all
;
}
}
# 代理后端API请求 - 使用更具体的路径
location
/api/
{
proxy_buffer_size
1024k
;
#设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers
16
1024k
;
#proxy_buffers缓冲区,网页平均在32k以下的设置
proxy_busy_buffers_size
2048k
;
#高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size
2048k
;
#设定缓存文件夹大小,大于这个值,将从upstream服务器传
proxy_pass
http://139.224.145.34:9002/
;
}
# 可能需要代理其他后端服务
# location /other-service/ {
# proxy_pass http://other-service:port/;
# }
}
package.json
View file @
e4e2e272
...
...
@@ -7,6 +7,8 @@
"type"
:
"module"
,
"scripts"
:
{
"dev"
:
"vite"
,
"build"
:
"vite build"
,
"build:dev"
:
"vite build --mode=development"
,
"build:prod"
:
"vite build"
,
"build:stage"
:
"vite build --mode staging"
,
"preview"
:
"vite preview"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment