web / Dockerfile
hanbinsite's picture
fix: use --ignore-scripts then pnpm rebuild to bypass pnpm 11 build policy
328d3a0
Raw History Blame Contribute Delete
1.18 kB
FROM node:22-slim AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN corepack enable
WORKDIR /app
# Copy package files first for layer caching
COPY package.json pnpm-lock.yaml ./
# Install all deps, allow build scripts explicitly
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile --ignore-scripts && \
pnpm rebuild @parcel/watcher esbuild vue-demi
# Copy source files
COPY . .
# Build Nuxt app
RUN pnpm build
RUN echo "Build success"
# ── Production image ──────────────────────────────────────────────────────────
FROM node:22-slim AS production
WORKDIR /app
# Copy built output
COPY --from=builder /app/.output /app/.output
# HuggingFace Spaces exposes port 7860
ENV PORT=7860
ENV HOST=0.0.0.0
# Nuxt SSR server environment variables
# Override at runtime via HF Space Secrets
ENV NUXT_PUBLIC_API_BASE=https://bin-api.hanbin666.top/user
ENV NUXT_API_BASE_URL=https://bin-api.hanbin666.top
EXPOSE 7860
CMD ["node", "/app/.output/server/index.mjs"]