0

I'm trying to write a dockerfile for my node application. I have two directories "backend" and "docker", one for the backend and the other for docker. How can i copy the package.json file that isn't in my docker director?

My structure: enter image description here

My Dockefile:

FROM node:latest

WORKDIR /app

COPY ../backend/package.json .

RUN npm install

COPY ../backend .

EXPOSE 8000

CMD ["yarn", "start:dev"]

Error log: COPY ../backend .

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref moby::g8h1qak04dvflrufe6k26qh1c: "/backend": not found

PS: I'm running the "docker build -t test ." in the directory project/docker

guirms
  • 49
  • 7
  • Verify or add your docker-compose file. `Build: context: ` is your reference path. https://stackoverflow.com/questions/65622477/what-is-context-in-docker-compose – Mate Aug 02 '23 at 19:40
  • I'm sorry, i want to build a dockerfile only, not a dockercompose one. My mistake – guirms Aug 02 '23 at 19:49

0 Answers0