-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
53 lines (37 loc) · 1.09 KB
/
Dockerfile
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
48
49
50
51
52
53
# Nuxt 3 builder
FROM node:22-alpine as builder
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV PNPM_HOME=/usr/local/bin
RUN pnpm add --global prisma
ARG VERSION
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
# 安装生产依赖
RUN pnpm install
ENV NODE_ENV=production
# 复制整个项目
COPY . .
# 生成Prisma客户端
RUN npx prisma generate
RUN echo $VERSION > /app/version
# 构建Nuxt应用
RUN pnpm run build
# Nuxt 3 production
FROM node:22-alpine
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV PNPM_HOME=/usr/local/bin
RUN pnpm add --global prisma
WORKDIR /app
ENV NODE_ENV=production
ENV NUXT_JWT_SECRET_KEY="uIWcy5NE9M2wmh9"
ENV NUXT_PUBLIC_TOKEN_KEY="iPOJWvmRggSw9FU"
ENV NUXT_PUBLIC_AVATAR_CDN="https://gravatar.cooluc.com/avatar/"
ENV SIMPLE_DISCUSS_VERSION=$VERSION
ENV NUXT_UPLOAD_DIR=/app/upload
COPY --from=builder /app/.output /app/.output
COPY --from=builder /app/prisma /app/prisma
COPY --from=builder /app/version /app/version
COPY --from=builder /app/start.sh /app/start.sh
EXPOSE 3000
RUN chmod +x /app/start.sh
CMD /app/start.sh