Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm-ci long loading now #1355

Open
Xazgl opened this issue Nov 1, 2024 · 0 comments
Open

Npm-ci long loading now #1355

Xazgl opened this issue Nov 1, 2024 · 0 comments

Comments

@Xazgl
Copy link

Xazgl commented Nov 1, 2024

I had a docker that used the command : [node_modules_prod 4/4] RUN --mount=type=cache,target=~/.npm npm ci --omit=dev
6 days ago everything worked perfectly and the build was successful. Today I tried and every time on this command, it hangs, it seems to be done only instead of a couple of seconds it can take 30 minutes and not finish. I tried reinstalling Docker, updated npm to the latest version, deleted node modiles and installed dependencies in the project again, but nothing helps. Where else can I look for the cause?
I haven't installed any new dependencies in the project for 6 days, I cleared the Docker cache, and I also cleared NPM with Force
Version: npm global 10.2.3 , node v18.19.0 , docker 4.34.3
my package-json:

"dependencies": {
    "@emotion/react": "^11.11.1",
    "@emotion/styled": "^11.11.0",
    "@mui/icons-material": "^5.14.12",
    "@mui/lab": "^5.0.0-alpha.170",
    "@mui/material": "^5.14.12",
    "@mui/x-data-grid": "^7.2.0",
    "@mui/x-date-pickers": "^7.3.1",
    "@radix-ui/react-accordion": "^1.1.2",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-slot": "^1.0.2",
    "@reduxjs/toolkit": "^1.9.7",
    "@types/bcryptjs": "^2.4.6",
    "@types/crypto-js": "^4.2.2",
    "@types/react-slick": "^0.23.13",
    "@types/xml2js": "^0.4.14",
    "@types/xmldom": "^0.1.34",
    "@uiw/react-md-editor": "^4.0.4",
    "bcryptjs": "^2.4.3",
    "classnames": "^2.3.2",
    "cookies-next": "^4.1.1",
    "crypto-js": "^4.2.0",
    "date-fns": "^3.6.0",
    "date-fns-tz": "^3.1.3",
    "dayjs": "^1.11.11",
    "exceljs": "^4.4.0",
    "file-saver": "^2.0.5",
    "fuse.js": "^7.0.0",
    "helmet": "^7.1.0",
    "install": "^0.13.0",
    "jszip": "^3.10.1",
    "nanoid": "^5.0.7",
    "next": "^14.2.3",
    "next-sitemap": "^4.2.3",
    "nodemailer": "^6.9.14",
    "nodemon": "^3.0.1",
    "npm": "^10.8.1",
    "prisma": "^5.11.0",
    "radix-ui": "^1.0.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-material-ui-carousel": "^3.4.2",
    "react-redux": "^8.1.3",
    "react-slick": "^0.30.2",
    "redux": "^4.2.1",
    "sharp": "^0.33.4",
    "slick-carousel": "^1.8.1",
    "xlsx": "^0.18.5",
    "xmldom": "^0.6.0",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@types/archiver": "^6.0.2",
    "@types/file-saver": "^2.0.7",
    "@types/node": "^20.12.12",
    "@types/react": "latest",
    "@types/react-dom": "latest",
    "@types/shelljs": "^0.8.15",
    "autoprefixer": "latest",
    "consola": "^3.2.3",
    "eslint": "latest",
    "eslint-config-next": "^14.1.1",
    "postcss": "latest",
    "tailwindcss": "latest",
    "typescript": "latest"
  },
  "optionalDependencies": {
    "@prisma/client": "^5.11.0",
    "axios": "^1.5.1",
    "shelljs": "^0.8.5",
    "xml2js": "^0.6.2"
  }

My Docker:

# multy stage dockerfile
FROM node:lts-alpine as node_modules_dev
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
RUN --mount=type=cache,target=~/.npm npm ci

FROM node:lts-alpine as node_modules_prod
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
RUN --mount=type=cache,target=~/.npm npm ci --omit=dev

FROM node:lts-alpine AS builder

# Create app directory
WORKDIR /app

# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
COPY prisma ./prisma/
COPY next.config.js ./
COPY --from=node_modules_dev /app/node_modules ./node_modules

RUN npx prisma generate

COPY . .

ENV NODE_ENV=production

# RUN npm run build
RUN --mount=type=cache,target=/app/.next/cache --mount=type=cache,target=~/.npm npm run build

FROM node:lts-alpine 
RUN apk add --update --no-cache imagemagick
RUN apk add --update --no-cache jpeg
RUN apk add --update --no-cache libwebp
RUN apk add --update --no-cache curl

WORKDIR /app

COPY package*.json ./
COPY --from=node_modules_prod /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY prisma ./prisma/
COPY next.config.js ./

COPY xmlTasks ./xmlTasks 
COPY static ./static
RUN mkdir -p static/images
COPY skillspace ./skillspace 
COPY report ./report
COPY applications ./applications
COPY insurance ./insurance 
COPY inparse ./inparse
COPY statictwo ./statictwo
COPY worker ./worker
COPY smartagent ./smartagent

RUN npx prisma generate

ENV NODE_ENV=production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant