0

I have followed file structure

...
   - public
   - app
   - docker/
        - node-js/Dockerfile
   docker-compose.yml
   package.json

in my dockerfile I have a logic to copy package.json and run npm install

FROM node:12.0.0-alpine

MAINTAINER Bogdan Dubyk <bogdan.dubyk@gmail.comn>

COPY package.json /var/www/frontend/
RUN npm install

CMD [ "npm", "start" ]

but I'm getting an error ERROR: Service 'node-js' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder184577258/package.json: no such file or directory while building the image, looks like Dockerfile looking for files only inside his own folder? is it possible to copy files from outside the folder?

I tried COPY ../../package.json /var/www/frontend/ but also getting error ERROR: Service 'node-js' failed to build: COPY failed: Forbidden path outside the build context: ../../package.json ()

Bogdan Dubyk
  • 4,756
  • 7
  • 30
  • 67

0 Answers0