Skip to content

Commit

Permalink
Optimize Dockerfile with node:lts and node:alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMohit2003 committed Apr 20, 2024
1 parent 8e3651d commit 934d75c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

FROM node:16 AS build-stage
FROM node:lts AS build-stage

WORKDIR /app

Expand All @@ -9,16 +8,18 @@ RUN npm install

COPY . .

# Run build as per the script defined in package.json
RUN npm run build

# Serve the app using Node.js
FROM node:16 AS production-stage
# Production stage using a minimal Node.js image
FROM node:alpine AS production-stage

# Install 'serve' to serve the application
RUN npm install -g serve

WORKDIR /app

# Copy the built application from the build stage
COPY --from=build-stage /app/dist /app

# Expose the port that 'serve' will run on
Expand Down

0 comments on commit 934d75c

Please sign in to comment.