File size: 1,009 Bytes
dc649b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:20-slim AS builder

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV NODE_OPTIONS=--max-old-space-size=8192
ENV TZ=Asia/Shanghai

RUN corepack enable

WORKDIR /app

# Copy all source files
COPY . /app

# Install dependencies and build only web-naive
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build --filter=@vben/web-naive

RUN echo "Build success"

# ── Production image ──────────────────────────────────────────────────────────
FROM nginx:stable-alpine AS production

# Support .mjs files
RUN echo 'types { application/javascript js mjs; }' > /etc/nginx/conf.d/mjs.conf

# Copy built files
COPY --from=builder /app/apps/web-naive/dist /usr/share/nginx/html

# Copy nginx config
COPY scripts/deploy/nginx.conf /etc/nginx/nginx.conf

# HuggingFace Spaces exposes port 7860
EXPOSE 7860

CMD ["nginx", "-g", "daemon off;"]