diff --git a/Dockerfile b/Dockerfile index cdf5bc3..e5cdbd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,15 @@ WORKDIR /app # Dependencies o'rnatish COPY package*.json ./ -RUN npm ci --legacy-peer-deps +RUN npm install --force # Kodlarni nusxalash va build qilish COPY . . -# Next.js standalone build (optimallashtirilgan) +# Environment variables (agar kerak bo'lsa) +ENV NEXT_TELEMETRY_DISABLED=1 + +# Next.js build RUN npm run build # Production stage @@ -25,10 +28,16 @@ ENV PORT=3000 RUN addgroup -g 1001 -S nodejs RUN adduser -S nextjs -u 1001 -# Faqat zarur fayllarni nusxalash +# Package.json va node_modules nusxalash +COPY --from=builder /app/package*.json ./ +COPY --from=builder /app/node_modules ./node_modules + +# Build qilingan fayllarni nusxalash +COPY --from=builder /app/.next ./.next COPY --from=builder /app/public ./public -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static + +# next.config kerak bo'lsa +COPY --from=builder /app/next.config.* ./ # Foydalanuvchi huquqlarini o'zgartirish RUN chown -R nextjs:nodejs /app @@ -37,4 +46,4 @@ USER nextjs EXPOSE 3000 -CMD ["node", "server.js"] \ No newline at end of file +CMD ["npm", "start"] \ No newline at end of file