Update dockerfile structure
This commit is contained in:
parent
ad7a737e2d
commit
888682cedd
2 changed files with 9 additions and 10 deletions
17
Dockerfile
17
Dockerfile
|
|
@ -1,24 +1,23 @@
|
||||||
FROM alpine AS base
|
FROM alpine AS base
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apk apk add nodejs python3 npm build-base
|
RUN --mount=type=cache,target=/var/cache/apk apk add nodejs python3 npm build-base
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
ADD package*.json .
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=dev
|
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=dev
|
||||||
|
ADD . .
|
||||||
COPY . .
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM base AS app
|
FROM base AS app
|
||||||
|
|
||||||
WORKDIR /app
|
ADD package*.json .
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
COPY --from=builder /app/dist ./
|
|
||||||
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=prod
|
RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --include=prod
|
||||||
RUN apk del --purge build-base python3
|
RUN apk del --purge build-base python3
|
||||||
|
ADD prisma.config.ts .
|
||||||
|
ADD prisma/ prisma/
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "start" ]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"build:prisma": "prisma generate",
|
"build:prisma": "prisma generate",
|
||||||
"build:tsc": "tsc",
|
"build:tsc": "tsc",
|
||||||
"build": "npm run build:prisma && npm run build:tsc",
|
"build": "npm run build:prisma && npm run build:tsc",
|
||||||
"start": "node .",
|
"start": "prisma migrate deploy && node .",
|
||||||
"dev": "npm run build && npm run start"
|
"dev": "npm run build && npm run start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue