即Dockerfile配置
FROM node:13-alpine as build-nodejs
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
ARG build_command=build_prod
RUN npm run ${build_command} -- --output-path=./dist/out
# Final nginx container
FROM nginx:1.13
RUN apt-get update && apt-get -y upgrade && apt-get -y install nginx-extras libnginx-mod-nchan
RUN rm -f etc/nginx/sites-enabled/default \
&& rm -f /etc/nginx/conf.d/default.conf \
&& rm -f /usr/share/nginx/html/index.html
WORKDIR /usr/share/nginx/html
COPY --from=build-nodejs /app/dist/out /usr/share/nginx/html
COPY default.conf /etc/nginx/sites-enabled/default
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
我收到错误步骤12/15:复制--from=build-nodejs /app/dist/out /usr/share/nginx/html复制失败:stat app/dist/out:文件不存在
1条答案
按热度按时间gmol16391#
看起来
npm run
步骤没有按预期创建输出。尝试使用
--progress plain
选项进行构建。这可以防止输出的串联,您应该能够看到该步骤的完整输出并检查问题。