I am following the exact steps but still it gets stuck when running npm command and I don’t know what went wrong here.
Here is the docker code:
FROM node:20-alpine
RUN addgroup app && adduser -S -G app app
USER app
WORKDIR /app
COPY package*.json ./
USER root
RUN chown -R app:app .
USER app
RUN npm install --verbose
COPY . .
EXPOSE 5173
CMD npm run dev
Here is the error message I’m getting:
docker compose up
[+] Building 21.3s (10/12) docker:desktop-linux
=> [web internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.69kB 0.0s
=> [web internal] load metadata for docker.io/library/node:20-alpine 1.8s
=> [web auth] library/node:pull token for registry-1.docker.io 0.0s
=> [web internal] load .dockerignore 0.0s
=> => transferring context: 663B 0.0s
=> [web 1/7] FROM docker.io/library/node:20-alpine@sha256:eb8101caae9ac02229bd64c024919fe3d4504ff7f329da79ca60a04db08 0.0s
=> [web internal] load build context 0.0s
=> => transferring context: 1.36kB 0.0s
=> CACHED [web 2/7] RUN addgroup app && adduser -S -G app app 0.0s
=> CACHED [web 3/7] WORKDIR /app 0.0s
=> [web 4/7] COPY package*.json ./ 0.0s
=> [web 5/7] RUN chown -R app:app . 0.2s
=> [web 6/7] RUN npm install --verbose 19.2s
=> => # npm http fetch GET 200 https://registry.npmjs.org/is-extglob 87ms (cache miss)
=> => # npm http fetch GET 200 https://registry.npmjs.org/array-union 90ms (cache miss)
=> => # npm http fetch GET 200 https://registry.npmjs.org/merge2 95ms (cache miss)
=> => # npm http fetch GET 200 https://registry.npmjs.org/brace-expansion 101ms (cache miss)
=> => # npm http fetch GET 200 https://registry.npmjs.org/fast-glob 189ms (cache miss)
=> => # npm http fetch GET 200 https://registry.npmjs.org/dir-glob 993ms (cache miss)
I’m beginner to it, I don’t know what I did wrong here.