更新了dockerfile

This commit is contained in:
2025-07-29 13:49:33 +08:00
parent f3b7a5aa62
commit ff2f21f145
3 changed files with 46 additions and 48 deletions

View File

@@ -1,37 +1,35 @@
# ------------- 依赖缓存阶段 -------------
FROM node:22.16-alpine AS base
# 国内镜像 FROM node:22-alpine AS build
RUN npm config set registry https://registry.npmmirror.com WORKDIR /app
# 置顶安装 pnpm@10.13.1 RUN npm config set registry https://registry.npmmirror.com
RUN npm install -g pnpm@10.13.1 RUN corepack enable
WORKDIR /app # Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration
COPY package.json pnpm-lock.yaml .npmrc ./
# 1⃣ 先把锁文件拷进来,让这一层可以 cache # Install dependencies
COPY package.json pnpm-lock.yaml .npmrc ./ RUN pnpm i
# 2⃣ 再执行安装 # Copy the entire project
RUN pnpm install --frozen-lockfile COPY . ./
# 3⃣ 再拷剩余源码 # Build the project
COPY . . RUN chmod +x patch-ui-pro.zsh && ./patch-ui-pro.zsh
RUN chmod +x patch-ui-pro.zsh && ./patch-ui-pro.zsh RUN pnpm run build
# ------------- 构建阶段 ------------- # Build Stage 2
FROM base AS builder
RUN pnpm build
# ------------- 运行阶段 ------------- FROM node:22-alpine
FROM node:22.16-alpine AS production WORKDIR /app
WORKDIR /app # Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./
# 拷贝构建产物 # Change the port and host
COPY --from=builder /app/.output ./.output ENV PORT=3000
ENV HOST=0.0.0.0
EXPOSE 3000 EXPOSE 3000
ENV NODE_ENV=production HOST=0.0.0.0 PORT=3000
CMD ["node", ".output/server/index.mjs"]
CMD ["node", "/app/server/index.mjs"]

View File

@@ -3,25 +3,25 @@ const providers = ref([
{ {
label: 'Google', label: 'Google',
icon: 'simple-icons-google', icon: 'simple-icons-google',
color: 'neutral', color: 'neutral' as const,
variant: 'subtle' variant: 'subtle' as const
}, },
{ {
label: 'GitHub', label: 'GitHub',
icon: 'simple-icons-github', icon: 'simple-icons-github',
color: 'neutral', color: 'neutral' as const,
variant: 'subtle' variant: 'subtle' as const
} }
]) ])
const fields = ref([ const fields = ref([
{ {
name: 'email', name: 'email',
type: 'text', type: 'text' as const,
label: 'Email' label: 'Email'
}, },
{ {
name: 'password', name: 'password',
type: 'password', type: 'password' as const,
label: 'Password' label: 'Password'
} }
]) ])

View File

@@ -3,25 +3,25 @@ const providers = ref([
{ {
label: 'Google', label: 'Google',
icon: 'simple-icons-google', icon: 'simple-icons-google',
color: 'neutral', color: 'neutral' as const,
variant: 'subtle' variant: 'subtle' as const
}, },
{ {
label: 'GitHub', label: 'GitHub',
icon: 'simple-icons-github', icon: 'simple-icons-github',
color: 'neutral', color: 'neutral' as const,
variant: 'subtle' variant: 'subtle' as const
} }
]) ])
const fields = ref([ const fields = ref([
{ {
name: 'email', name: 'email',
type: 'text', type: 'text' as const,
label: 'Email' label: 'Email'
}, },
{ {
name: 'password', name: 'password',
type: 'password', type: 'password' as const,
label: 'Password' label: 'Password'
} }
]) ])