这是Dockerfile:
if ! echo $JAVA_HOME | grep 64 ; then
echo "No valid JRE installation found in $JAVA_HOME to match ARCH $ARCH or $JAVA_HOME not set properly."; exit 1
fi
使用命令'docker build'在本地计算机上构建映像时。 -正常,但是当我尝试将项目放入zeit时,出现下一个错误:
# tag block to refering
FROM node:alpine as builder
WORKDIR /home/server
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "build"]
# on second step use another core image
FROM nginx
# copy files builded on previous step
COPY --from=builder /home/server/build usr/share/nginx/html
可能是什么?谢谢。
答案 0 :(得分:1)
Your first stage doesn't actually RUN the build command,因此构建目录为空。将CMD行更改为RUN行。
一个技巧:docker build
序列的每一行都产生自己的中间层,并且每一层都是可运行的Docker映像。您会看到类似
Step 6/8: CMD ["npm", "run", "build"]
---> Running in 02071fceb21b
---> f52f38b7823e
最后一个数字是有效的Docker映像ID,您可以
docker run --rm -it f52f38b7823e sh
查看该图像中的内容。