Closed ghost closed 4 years ago
The node
Docker image contains both yarn
and npm
. You can replace yarn
with the npm
equivalent and it will run the same. I don't see a need to add another Docekrfile when it's a small change like that
The
node
Docker image contains bothyarn
andnpm
. You can replaceyarn
with thenpm
equivalent and it will run the same. I don't see a need to add another Docekrfile when it's a small change like that
Thank you for your quick reply.
I have followed your advice and the Dockerfile
is working. 🙂
FROM node:12 as BASE
WORKDIR /app
COPY package.json \
package-lock.json \
./
RUN npm install --production
# lint and formatting configs are commented out
# uncomment if you want to add them into the build process
FROM BASE AS DEV
COPY nest-cli.json \
tsconfig.* \
# .eslintrc.js \
# .prettierrc \
./
# bring in src from context
COPY ./src/ ./src/
RUN npm install
# RUN yarn lint
RUN npm run build
# use one of the smallest images possible
FROM node:12-alpine
# get package.json from base
COPY --from=BASE /app/package.json ./
# get the dist back
COPY --from=DEV /app/dist/ ./dist/
# get the node_modules from the intial cache
COPY --from=BASE /app/node_modules/ ./node_modules/
# expose application port
EXPOSE 3000
# start
CMD ["node", "dist/main.js"]
(Sorry, I'm new to Node and Nest, so I didn't know that npm
and yarn
have similar commands.)
Hi.
Could you please add a version of this Docker image that uses
npm
(instead ofyarn
)?Thank you. Greetings Erol