Hi,
I’m following the basic Docker tutorials and now executing the following to create and image:
# Start your image with a node base image
FROM node:18-alpine
# The /app directory should act as the main application directory
WORKDIR /app
# Copy the app package and package-lock.json file
COPY package*.json ./
# Copy local directories to the current local directory of our docker image (/app)
COPY ./src ./src
COPY ./public ./public
# Install node packages, install serve, build the app, and remove dependencies at the end
RUN npm install \
&& npm install -g serve \
&& npm run build \
&& rm -fr node_modules
EXPOSE 3000
# Start the app using serve command
CMD [ "serve", "-s", "build" ]
The result is that it’s stuck at “npm install” and not seeming to progress (unless this is supposed to take a couple hours which I’ve not tried yet).
~/welcome-to-docker$ docker build -t welcome-to-docker-test .
[+] Building 1371.8s (9/10) docker:desktop-linux
=> [internal] load build context 0.0s
=> => transferring context: 393B 0.0s
=> CACHED [2/6] WORKDIR /app 0.0s
=> CACHED [3/6] COPY package*.json ./ 0.0s
=> CACHED [4/6] COPY ./src ./src 0.0s
=> CACHED [5/6] COPY ./public ./public 0.0s
=> [6/6] RUN npm install && npm install -g serve && npm run build && rm -fr node_modules 3370.8s
=> => # npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the
=> => # compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compa
=> => # tibility
=> => # npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plug
=> => # in-terser
=> => # npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
Neither CPU, Memory or network seem to be the bottleneck: