From ec681238cdef0f5d8e35747f3676c0dfd53d9b07 Mon Sep 17 00:00:00 2001 From: Bill Chirico Date: Mon, 6 Nov 2023 12:42:01 -0500 Subject: [PATCH] feat(Dockerfile): Add build step and update CMD This commit adds a build step to the Dockerfile, allowing for the application to be built within the container. Additionally, it updates the CMD instruction to use "npm serve" instead of "run.sh". feat(Dockerfile): Add build step and update CMD This commit adds a build step to the Dockerfile, allowing for the application to be built within the container. Additionally, it updates the CMD instruction to use "npm run serve" instead of "run.sh". --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e83376a..b4a8752 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,18 +6,18 @@ WORKDIR /opt/app COPY package.json package-lock.json ./ COPY . / # Install production dependencies only -RUN npm ci --only=production -# Build the application -RUN npm run build +RUN npm ci # Stage 2: Build the application FROM node:lts-alpine AS builder WORKDIR /opt/app # Copy all files from the current directory to the working directory in the container +COPY . . # Copy node_modules from the "deps" stage -COPY package.json package-lock.json ./ COPY --from=deps /opt/app/node_modules ./node_modules +# Build the application +RUN npm run build # Stage 3: Create the production image FROM node:lts-alpine AS runner @@ -30,4 +30,4 @@ EXPOSE 5000 COPY --from=builder /opt/app/build ./build COPY package.json package-lock.json ./ # Define the command to run the application -CMD run.sh \ No newline at end of file +CMD npm run serve \ No newline at end of file