英文:
getting COPY failed: stat app/dist/out: file does not exist when building angular docker container
问题
以下是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
# 最终的 nginx 容器
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;"]
我遇到了错误
Step 12/15 : COPY --from=build-nodejs /app/dist/out /usr/share/nginx/html
COPY failed: stat app/dist/out: file does not exist
英文:
that is Dockerfile configuration
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;"]
I'm getting error
Step 12/15 : COPY --from=build-nodejs /app/dist/out /usr/share/nginx/html
COPY failed: stat app/dist/out: file does not exist
答案1
得分: 1
尝试使用 --progress plain
选项进行构建。这会阻止输出的串联,您应该能够查看该步骤的完整输出并检查是否存在问题。
英文:
It would appear the npm run
step is not creating the output as expected.
Try building with the --progress plain
option. This prevents the concatenation of the output and you should be able to see the complete output of that step and check for issues.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论