我正在尝试对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"