From 3ad0f9b5383b11ff25c6d39d8ddec2214113dc12 Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Thu, 27 Nov 2025 06:43:04 +0100 Subject: [PATCH] Fix Yarn 4.x deprecated commands in Dockerfile - Replace --frozen-lockfile with --immutable in builder stage - Replace --frozen-lockfile --production with --immutable + autoclean in production stage - This resolves the Yarn 4.9.0 deprecation warnings and build failures --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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