diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..866e8ee --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.html linguist-detectable=false +*.vue linguist-detectable=true diff --git a/.gitignore b/.gitignore index 71e2bf4..9fc774f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,22 @@ logs *.log npm-debug.log* +npminstall-debug.log yarn-debug.log* yarn-error.log* +# Common local files +dist-ssr +*.local +.cursorrules +.claude +.codex +.env.development +.env.production +.scratch +.agents +Thumbs.db + # Runtime data pids *.pid @@ -91,4 +104,4 @@ dist/ # OS .DS_Store -Thumbs.db \ No newline at end of file +Thumbs.db diff --git a/Dockerfile b/Dockerfile index 97fa8b5..83c6569 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,17 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories # 设置工作目录 WORKDIR /build -# 设置 npm 镜像源 -RUN npm config set registry https://registry.npmmirror.com +# 安装 pnpm +RUN corepack enable && corepack prepare pnpm@10.15.0 --activate -# 复制 package.json(利用 Docker 缓存) -COPY package.json ./ +# 设置 pnpm 镜像源 +RUN pnpm config set registry https://registry.npmmirror.com + +# 复制 package.json 和 pnpm-lock.yaml(利用 Docker 缓存) +COPY package.json pnpm-lock.yaml ./ # 安装所有依赖 -RUN npm install --legacy-peer-deps +RUN pnpm install --frozen-lockfile # 安装 git (用于获取 commit 信息) RUN apk add --no-cache git @@ -24,21 +27,18 @@ RUN apk add --no-cache git # 复制源代码 COPY . . -# 列出文件确认复制成功 -RUN ls -la - # 创建 src 目录软链接 (兼容 uni-app 新版本) RUN mkdir -p src && \ ln -sf /build/manifest.json /build/src/manifest.json && \ ln -sf /build/pages.json /build/src/pages.json # 构建 H5 生产版本 -RUN npm run build:h5 +RUN pnpm run build:h5 # ================================ # 阶段 2: 运行阶段 # ================================ -FROM --platform=linux/amd64 nginx:alpine +FROM --platform=linux/amd64 nginx:1.31.2-alpine # 使用阿里云镜像源加速 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index feaff02..409c5ce 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -9,6 +9,9 @@ services: - '3003:80' networks: - device-voice-network + tmpfs: + - /run:rw + - /tmp:rw healthcheck: test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:80/health'] interval: 30s