zhongrj
2025-02-17 e91e69cc71a288f66b95c814e9bb71689f02be02
测试
3 files modified
20 ■■■■ changed files
Dockerfile 17 ●●●● patch | view | raw | blame | history
docker-compose.yml 2 ●●●●● patch | view | raw | blame | history
index.html 1 ●●●● patch | view | raw | blame | history
Dockerfile
@@ -1,5 +1,5 @@
# 使用官方的 Node.js 20.10.0 版本作为基础镜像
FROM node:v20.14.0
FROM node:v20.14.0 AS build-env
# 设置工作目录
WORKDIR /app
@@ -21,4 +21,17 @@
 
# 将构建阶段中的打包文件拷贝到最终镜像的指定目录
# 注意:这里使用了 `--from=build-env` 来引用前面的构建阶段
COPY /app/dist /app/dist-final
# COPY --from=build-env /app/dist /app/dist-final
# 创建一个新的镜像阶段来服务构建后的文件
FROM nginx:alpine
# 复制构建后的文件到 Nginx 的 html 目录
# 注意:这里假设在 build-env 阶段中 dist 目录被正确创建在 /app/dist
COPY --from=build-env /app/dist /app/dist-final
# 暴露端口
EXPOSE 8310
# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]
docker-compose.yml
@@ -5,5 +5,3 @@
    container_name: pilot-h5
    ports:
      - "8310:80"
    volumes:
      - /software/service/drone/web/pilot-h5:/app/dist-final
index.html
@@ -4,6 +4,7 @@
    <meta charset="UTF-8">
    <link rel="icon" href="/favicon.ico">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
     <!-- test -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>低空无人机监测网移动应用</title>
  </head>