服务'client'的构建失败:COPY失败:stat /var/lib/docker/tmp/docker-builder271679502/package.json:没有这样的文件或目录

时间:2020-10-13 12:01:22

标签: reactjs docker docker-compose

我正在尝试对React.js应用程序进行docker化,但是每次尝试进行docker-compose时,都会从标题中得到错误,但我不知道为什么会发生。

这是我的Dockerfile:

    # get the base node image
FROM node:alpine as builder

RUN mkdir /app
# set the working dir for container
WORKDIR /app

# copy the json file first
COPY package.json /app

# install npm dependencies
RUN npm install

# copy other project files

COPY . /app

# build the folder
CMD [ "npm", "run", "start" ]

这是我的撰写文件

  version: "3.8"
    services:
        client:
            container_name: client
            stdin_open: true
            build:
                context: .
                dockerfile: Dockerfile.dev
            ports:
                - "3000:3000"
            volumes:
                - "/app/node_modules"
                - "./:/app"

0 个答案:

没有答案