Update Dockerfile

This commit is contained in:
2025-12-25 10:50:11 +00:00
parent 70d4250b7b
commit e7b445c258

View File

@@ -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"]
CMD ["npm", "start"]