-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update dockerfile to npm i instead of copy deps
- Loading branch information
1 parent
a53f602
commit 3b1d43d
Showing
2 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
# Install dependencies only when needed | ||
FROM docker.io/node:lts-alpine as deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine | ||
# to understand why libc6-compat might be needed. | ||
FROM docker.io/node:16-alpine as deps | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /usr/src/app | ||
COPY ./node_modules ./node_modules | ||
|
||
# Production image, copy all the files and run nest | ||
COPY package*.json ./ | ||
RUN npm install --only=production --ignore-scripts | ||
|
||
FROM docker.io/node:lts-alpine as runner | ||
RUN apk add --no-cache dumb-init | ||
ENV NODE_ENV production | ||
ENV PORT 3000 | ||
WORKDIR /usr/src/app | ||
COPY --from=deps /usr/src/app/node_modules ./node_modules | ||
COPY ./node_modules/@prisma ./node_modules/@prisma | ||
COPY dist/apps/api . | ||
RUN chown -R node:node . | ||
EXPOSE 3000 | ||
CMD ["dumb-init", "node", "main.js"] | ||
CMD ["dumb-init", "node", "main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# Install dependencies only when needed | ||
FROM docker.io/node:lts-alpine as deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine | ||
# to understand why libc6-compat might be needed. | ||
FROM docker.io/node:16-alpine as deps | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /usr/src/app | ||
COPY ./node_modules ./node_modules | ||
|
||
# Production image, copy all the files and run nest | ||
COPY package*.json ./ | ||
RUN npm install --only=production --ignore-scripts | ||
|
||
FROM docker.io/node:lts-alpine as runner | ||
RUN apk add --no-cache dumb-init | ||
ENV NODE_ENV production | ||
ENV PORT 3000 | ||
WORKDIR /usr/src/app | ||
COPY --from=deps /usr/src/app/node_modules ./node_modules | ||
COPY ./node_modules/@prisma ./node_modules/@prisma | ||
COPY dist/apps/gateway . | ||
RUN chown -R node:node . | ||
EXPOSE 3000 | ||
CMD ["dumb-init", "node", "main.js"] | ||
CMD ["dumb-init", "node", "main.js"] |