All checks were successful
CI / ci (push) Successful in 1m34s
补齐 Prisma 配置文件复制步骤,确保容器内执行 prisma migrate deploy 时能够读取 datasource 配置并完成迁移。 Made-with: Cursor
38 lines
1017 B
Docker
38 lines
1017 B
Docker
FROM node:22-alpine AS base
|
|
WORKDIR /app
|
|
RUN apk add --no-cache libc6-compat openssl
|
|
RUN npm i -g pm2
|
|
|
|
FROM base AS deps
|
|
COPY package.json yarn.lock ./
|
|
COPY prisma.config.ts ./
|
|
COPY prisma ./prisma
|
|
ENV DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:5432/postgres?schema=public"
|
|
RUN yarn config set registry https://registry.npmmirror.com \
|
|
&& npm config set registry https://registry.npmmirror.com \
|
|
&& yarn config set network-timeout 600000 -g
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
FROM deps AS build
|
|
COPY tsconfig.json ./
|
|
COPY prisma ./prisma
|
|
COPY src ./src
|
|
RUN yarn build
|
|
|
|
FROM base AS runner
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY --from=build /app/dist ./dist
|
|
COPY --from=build /app/prisma ./prisma
|
|
COPY package.json yarn.lock ./
|
|
COPY prisma.config.ts ./
|
|
COPY deploy/docker/app.entrypoint.sh ./app.entrypoint.sh
|
|
COPY deploy/docker/ecosystem.config.cjs ./ecosystem.config.cjs
|
|
|
|
RUN chmod +x ./app.entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
CMD ["./app.entrypoint.sh"]
|