I’m trying to make a build a Docker image of a react application.
Here is the Dockerfile:
# pull official base image FROM node:13.12.0-alpine # set working directory WORKDIR /app # add `/app/node_modules/.bin` to $PATH ENV PATH /app/node_modules/.bin:$PATH ARG REACT_APP_BASEURL='https://localhost:8081' ENV REACT_APP_BASEURL=$REACT_APP_BASEURL # install app dependencies COPY package.json ./ COPY package-lock.json ./ RUN npm install # add app COPY . ./ #EXPOSE EXPOSE 3000 # start app CMD ["npm", "start"]
So, I build with the command line:
docker build -f Dockerfile -t api_front .
and I’ve this error message:
If I check the version of npm with
npm -v , I’ve the latest one (7.19.1)
If I go to the project folder and I run
npm install , everything is up-to-date
If I start the application with
npm start , everything is ok and the api is running…
What is the problem?
Source: Docker Questions