getting COPY failed: stat app/dist/out: file does not exist when building angular docker container

huangapple go评论64阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年5月28日 05:00:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76349020.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定