File size: 1,182 Bytes
d3fbaec 408e152 328d3a0 408e152 d3fbaec 408e152 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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"]
|