I’m learning Docker. For many times I’ve seen that Dockerfile
has WORKDIR
command:
FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
CMD [ “npm”, “start” ]
Can’t I just omit WORKDIR
and Copy
and just have my Dockerfile
at the root of my project? What are the downsides of using this approach?