update dev dockerfiles
This commit is contained in:
@ -2,9 +2,6 @@
|
||||
# Use alpine for reduced image size
|
||||
FROM node:19.6-alpine AS base
|
||||
|
||||
# Set NODE_ENV
|
||||
ENV NODE_ENV production
|
||||
|
||||
# Specify working directory other than /
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
@ -12,21 +9,20 @@ WORKDIR /usr/src/app
|
||||
# dependencies (better layer caching)
|
||||
COPY package*.json ./
|
||||
|
||||
# Development stage to include dev + production dependencies
|
||||
FROM base AS dev
|
||||
FROM base as dev
|
||||
|
||||
# Install all dependencies (including development ones)
|
||||
# For the dev image
|
||||
RUN --mount=type=cache,target=/usr/src/app/.npm \
|
||||
npm set cache /usr/src/app/.npm && \
|
||||
npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "npm", "run", "dev" ]
|
||||
CMD ["npm", "run", "dev"]
|
||||
|
||||
# Production stage optimzed for deployment
|
||||
FROM base AS production
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user