This commit is contained in:
2025-09-16 09:11:23 +02:00
parent cbf2e3c738
commit 8841bbf13a

View File

@@ -7,14 +7,10 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
# Install dependencies based on the preferred package manager # Install dependencies with npm only
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ COPY package.json package-lock.json ./
RUN \ RUN npm install
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ RUN npm ci
elif [ -f package-lock.json ]; then npm install && npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM base AS builder FROM base AS builder
@@ -26,13 +22,8 @@ COPY . .
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production ENV NODE_ENV=production
# Build the application # Build the application using npm only
RUN \ RUN npm run build
if [ -f yarn.lock ]; then yarn build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm build; \
else echo "Lockfile not found." && exit 1; \
fi
# Production image, copy all the files and run next # Production image, copy all the files and run next
FROM base AS runner FROM base AS runner