Skip to content

Commit

Permalink
build: lower build steps
Browse files Browse the repository at this point in the history
  • Loading branch information
timeowilliams committed Sep 21, 2024
1 parent 99713d9 commit 32bc603
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ WORKDIR /app
COPY package*.json ./

# Install production dependencies only
RUN npm install --only=prod

# Install Webpack and its plugins temporarily for the build process
RUN npm install webpack webpack-cli mini-css-extract-plugin terser-webpack-plugin \
babel-loader @babel/core @babel/preset-env @babel/preset-react \
html-webpack-plugin webpack-bundle-analyzer
RUN npm install

# Copy the rest of the application files
COPY . .
Expand All @@ -24,10 +19,6 @@ ENV NODE_ENV=production
# Run Webpack to build the production bundle
RUN npx webpack --mode production

# Clean up unnecessary dev dependencies (Webpack and related tools)
RUN npm uninstall webpack webpack-cli mini-css-extract-plugin terser-webpack-plugin \
babel-loader @babel/core @babel/preset-env @babel/preset-react \
html-webpack-plugin webpack-bundle-analyzer

# Stage 2: Serve the app with nginx
FROM nginx:alpine
Expand Down

0 comments on commit 32bc603

Please sign in to comment.