Update dockerfile structure

This commit is contained in:
kimpure 2026-02-10 12:02:23 +00:00
parent ad7a737e2d
commit 888682cedd
2 changed files with 9 additions and 10 deletions

View file

@ -1,24 +1,23 @@
FROM alpine AS base
RUN --mount=type=cache,target=/var/cache/apk apk add nodejs python3 npm build-base
WORKDIR /app
FROM base AS builder
WORKDIR /app
COPY package*.json ./
ADD package*.json .
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=dev
COPY . .
ADD . .
RUN npm run build
FROM base AS app
WORKDIR /app
COPY package*.json ./
COPY --from=builder /app/dist ./
ADD package*.json .
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=prod
RUN apk del --purge build-base python3
ADD prisma.config.ts .
ADD prisma/ prisma/
COPY --from=builder /app/dist ./dist
CMD [ "npm", "start" ]

View file

@ -7,7 +7,7 @@
"build:prisma": "prisma generate",
"build:tsc": "tsc",
"build": "npm run build:prisma && npm run build:tsc",
"start": "node .",
"start": "prisma migrate deploy && node .",
"dev": "npm run build && npm run start"
},
"dependencies": {