revert node dockerfile 8 modifications

This commit is contained in:
sid palas
2023-02-21 21:23:34 -05:00
parent e796267218
commit d7ceeb094d

View File

@ -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" ]