diff --git a/Dockerfile b/Dockerfile index 9fda78d..070864b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Multi-stage build for Node.js frontend application -FROM node:22-alpine AS builder +FROM node:22.21.1-alpine3.20 AS builder # Enable Corepack for Yarn 4.x RUN corepack enable @@ -11,7 +11,7 @@ WORKDIR /app COPY package.json yarn.lock ./ # Install dependencies -RUN yarn install --frozen-lockfile +RUN yarn install --immutable # Copy source code COPY . . @@ -20,7 +20,7 @@ COPY . . RUN yarn build # Production stage -FROM node:22-alpine AS production +FROM node:22.21.1-alpine3.20 AS production # Enable Corepack for Yarn 4.x RUN corepack enable @@ -35,8 +35,8 @@ WORKDIR /app # Copy package files COPY package.json yarn.lock ./ -# Install only production dependencies -RUN yarn install --frozen-lockfile --production && yarn cache clean +# Install all dependencies first, then clean up dev dependencies +RUN yarn install --immutable && yarn autoclean --force # Copy built application from builder stage COPY --from=builder --chown=nextjs:nodejs /app/dist ./dist