update
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# build output
|
||||
dist/
|
||||
|
||||
# generated types
|
||||
.astro/
|
||||
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
.env.production
|
||||
|
||||
# macOS-specific files
|
||||
.DS_Store
|
||||
|
||||
# jetbrains setting folder
|
||||
.idea/
|
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@ -0,0 +1,47 @@
|
||||
# ================================
|
||||
# 第一步:构建阶段
|
||||
# ================================
|
||||
FROM cimg/node:22.15.1 AS builder
|
||||
|
||||
# 设置国内 npm 镜像加速
|
||||
RUN npm config set registry https://registry.npmmirror.com/
|
||||
|
||||
# 切换为 root 用户安装 pnpm
|
||||
USER root
|
||||
# 如果你使用 pnpm,则安装 pnpm
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
# 切回默认用户 circleci(cimg 镜像默认非 root 用户)
|
||||
USER circleci
|
||||
# WORKDIR /app
|
||||
|
||||
# 先复制依赖清单,利用 Docker 缓存
|
||||
COPY package.json ./
|
||||
# 如果你没有 pnpm-lock.yaml,使用 npm 的 package-lock.json
|
||||
COPY package-lock.json ./
|
||||
# COPY package-lock.json ./ # 如果你用的是 npm
|
||||
|
||||
# 安装依赖
|
||||
RUN pnpm install
|
||||
|
||||
# 再复制源码
|
||||
# COPY . .
|
||||
|
||||
# 进行构建(适用于 Astro、Next.js、Vite 等项目)
|
||||
RUN pnpm build
|
||||
|
||||
# ================================
|
||||
# 第二步:运行阶段(只保留 dist)
|
||||
# ================================
|
||||
FROM cimg/node:22.15.1
|
||||
|
||||
# 设置国内 npm 镜像(可选)
|
||||
RUN npm config set registry https://registry.npmmirror.com/
|
||||
|
||||
# WORKDIR /app
|
||||
|
||||
# 只复制构建产物和依赖
|
||||
# COPY --from=builder /app .
|
||||
|
||||
# 启动 SSR 项目(Astro SSR 情况)
|
||||
CMD ["node", "dist/server/entry.mjs"]
|
Reference in New Issue
Block a user