修改vue docker 配置文件

This commit is contained in:
BBIT-Kai
2025-05-12 11:30:27 +08:00
parent 369980293e
commit cdaa958e75
5 changed files with 14 additions and 12 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
# 端口号 # 端口号
VITE_PORT=8093 VITE_PORT=8090
VITE_BASE=/ VITE_BASE=/
@@ -10,7 +10,7 @@ VITE_GLOB_API_URL=/api
VITE_NITRO_MOCK=false VITE_NITRO_MOCK=false
# 是否打开 devtoolstrue 为打开,false 为关闭 # 是否打开 devtoolstrue 为打开,false 为关闭
VITE_DEVTOOLS=TRUE VITE_DEVTOOLS=false
# 是否注入全局loading # 是否注入全局loading
VITE_INJECT_APP_LOADING=true VITE_INJECT_APP_LOADING=true
+2 -2
View File
@@ -1,7 +1,7 @@
VITE_BASE=/ VITE_BASE=/
# 接口地址 # 接口地址
VITE_GLOB_API_URL=https://171.212.101.199:8089/api VITE_GLOB_API_URL=http://171.212.101.199:8089/api
# 是否开启压缩,可以设置为 none, brotli, gzip # 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=none VITE_COMPRESS=none
@@ -16,4 +16,4 @@ VITE_ROUTER_HISTORY=hash
VITE_INJECT_APP_LOADING=true VITE_INJECT_APP_LOADING=true
# 打包后是否生成dist.zip # 打包后是否生成dist.zip
VITE_ARCHIVER=true VITE_ARCHIVER=false
+7 -5
View File
@@ -1,4 +1,4 @@
FROM node:22-slim AS builder FROM node:slim AS builder
# --max-old-space-size # --max-old-space-size
ENV PNPM_HOME="/pnpm" ENV PNPM_HOME="/pnpm"
@@ -15,23 +15,25 @@ COPY . /app
# 安装依赖 # 安装依赖
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build --filter=\!./docs # RUN pnpm run build --filter=\!./docs
RUN pnpm run build --filter=@vben/web-antd
RUN echo "Builder Success 🎉" RUN echo "Builder Success 🎉"
FROM nginx:stable-alpine AS production FROM nginx:1.27.4-alpine AS production
# 配置 nginx # 配置 nginx
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \ RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \
&& rm -rf /etc/nginx/conf.d/default.conf && rm -rf /etc/nginx/conf.d/default.conf
# 复制构建产物 # 复制构建产物
COPY --from=builder /app/playground/dist /usr/share/nginx/html COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html
# 复制 nginx 配置 # 复制 nginx 配置
COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf
EXPOSE 8080 EXPOSE 8090
# 启动 nginx # 启动 nginx
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
@@ -3,7 +3,7 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
LOG_FILE=${SCRIPT_DIR}/build-local-docker-image.log LOG_FILE=${SCRIPT_DIR}/build-local-docker-image.log
ERROR="" ERROR=""
IMAGE_NAME="vben-admin-local" IMAGE_NAME="ce-vue"
function stop_and_remove_container() { function stop_and_remove_container() {
# Stop and remove the existing container # Stop and remove the existing container
@@ -36,7 +36,7 @@ function log_message() {
else else
echo "docker image with tag '${IMAGE_NAME}' built sussessfully. Use below sample command to run the container" echo "docker image with tag '${IMAGE_NAME}' built sussessfully. Use below sample command to run the container"
echo "" echo ""
echo "docker run -d -p 8010:8080 --name ${IMAGE_NAME} ${IMAGE_NAME}" echo "docker run -d -p 8010:8090 --name ${IMAGE_NAME} ${IMAGE_NAME}"
fi fi
} }
+1 -1
View File
@@ -47,7 +47,7 @@ http {
# gzip_vary on; # gzip_vary on;
server { server {
listen 8080; listen 8090;
server_name localhost; server_name localhost;
location / { location / {