diff --git a/README.md b/README.md index 0b4c8a1..b60cdb8 100644 --- a/README.md +++ b/README.md @@ -75,15 +75,20 @@ Inside the `docker-simple-app` folder, create a file named `Dockerfile``. This f # Use the official Node.js LTS image based on Alpine FROM node:lts-alpine -# Update apk and explicitly install OpenSSL -RUN apk update && apk add --no-cache openssl +# Set environment variables for production +ENV NODE_ENV=production + +# Update apk and explicitly install OpenSSL and other necessary dependencies +RUN apk update && apk add --no-cache openssl bash # Set working directory inside the container WORKDIR /app -# Copy package.json and package-lock.json and install dependencies +# Copy package.json and package-lock.json first to leverage Docker cache COPY package.json package-lock.json ./ -RUN npm install --production + +# Install dependencies securely +RUN npm ci --only=production # Copy the rest of the application files COPY . . @@ -152,4 +157,4 @@ docker stop docker ps -a ``` --- ---- \ No newline at end of file +---