forked from kingwrcy/moments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (34 loc) · 905 Bytes
/
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
# Nuxt 3 builder
FROM node:22.2.0-alpine as builder
ARG VERSION
WORKDIR /app
COPY package*.json ./
# 安装生产依赖
RUN npm install
# 复制整个项目
COPY . .
# 生成Prisma客户端
RUN npx prisma generate
RUN echo $VERSION > /app/version
ENV NODE_ENV=production
# 构建Nuxt应用
RUN npm run build
# Nuxt 3 production
FROM node:22.2.0-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV DATABASE_URL="file:/app/data/db.sqlite"
ENV UPLOAD_DIR="/app/data/upload"
ENV CONFIG_FILE="/app/data/config.json"
ENV MOMENTS_VERSION=$VERSION
RUN mkdir -p /app/data/upload
COPY --from=builder /app/.output /app/.output
COPY --from=builder /app/prisma /app/prisma
COPY --from=builder /app/start.sh /app/start.sh
COPY --from=builder /app/version /app/version
COPY --from=builder /app/config.json .
RUN npm init -y
RUN npm install -g prisma
RUN chmod +x /app/start.sh
EXPOSE 3000
CMD /app/start.sh