From d7ceeb094d2bdccab74db4c8d4ae183c28b97ce1 Mon Sep 17 00:00:00 2001 From: sid palas Date: Tue, 21 Feb 2023 21:23:34 -0500 Subject: [PATCH] revert node dockerfile 8 modifications --- .../api-node/Dockerfile.8 | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/06-building-container-images/api-node/Dockerfile.8 b/06-building-container-images/api-node/Dockerfile.8 index 3930047..2bdc121 100644 --- a/06-building-container-images/api-node/Dockerfile.8 +++ b/06-building-container-images/api-node/Dockerfile.8 @@ -1,6 +1,9 @@ # Pin specific version for stability # Use alpine for reduced image size -FROM node:19.6-alpine AS base +FROM node:19.6-alpine + +# Set NODE_ENV +ENV NODE_ENV production # Specify working directory other than / WORKDIR /usr/src/app @@ -9,21 +12,6 @@ WORKDIR /usr/src/app # dependencies (better layer caching) COPY package*.json ./ -FROM base as dev - -RUN --mount=type=cache,target=/usr/src/app/.npm \ - npm set cache /usr/src/app/.npm && \ - npm install - -COPY . . - -CMD ["npm", "run", "dev"] - -FROM base as production - -# Set NODE_ENV -ENV NODE_ENV production - # Install only production dependencies # Use cache mount to speed up install of existing dependencies RUN --mount=type=cache,target=/usr/src/app/.npm \ @@ -44,4 +32,4 @@ COPY --chown=node:node ./src/ . # Indicate expected port EXPOSE 3000 -CMD [ "node", "index.js" ] +CMD [ "node", "index.js" ] \ No newline at end of file