Skip to content

Commit

Permalink
feat(Dockerfile): Add build step and update CMD
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
BillChirico committed Nov 6, 2023
1 parent 3675ac4 commit ec68123
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
CMD npm run serve

0 comments on commit ec68123

Please sign in to comment.