nginx 获取COPY失败:stat app/dist/out:在构建Angular Docker容器时文件不存在

ifsvaxew  于 2023-05-28  发布在  Nginx
关注(0)|答案(1)|浏览(165)

即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:文件不存在

gmol1639

gmol16391#

看起来npm run步骤没有按预期创建输出。
尝试使用--progress plain选项进行构建。这可以防止输出的串联,您应该能够看到该步骤的完整输出并检查问题。

相关问题