Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何调试Docker Cloud Build上未生成的dist/is?_Docker_Webpack_Docker Compose_Dockerfile_Docker Cloud - Fatal编程技术网

如何调试Docker Cloud Build上未生成的dist/is?

如何调试Docker Cloud Build上未生成的dist/is?,docker,webpack,docker-compose,dockerfile,docker-cloud,Docker,Webpack,Docker Compose,Dockerfile,Docker Cloud,我正在尝试自动化在DockerLoud上构建,以便为我的前端构建一个docker容器 我有 web.dockerfile ### STAGE 1: Build ### FROM node:9.3.0-alpine as builder COPY package.json ./ RUN npm set progress=false && npm config set depth 0 && npm cache clean --force ## Storing

我正在尝试自动化DockerLoud上构建,以便为我的前端构建一个docker容器


我有 web.dockerfile

### STAGE 1: Build ###
FROM node:9.3.0-alpine as builder

COPY package.json ./

RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i
RUN mkdir /web
RUN cp -R ./node_modules ./web

WORKDIR /web

COPY . .

## Build the angular app in production mode and store the artifacts in dist folder
RUN $(npm bin)/ng build --prod --build-optimizer

### STAGE 2: Setup ###

FROM nginx:1.13.8-alpine

COPY nginx.conf /etc/nginx/nginx.conf
COPY site.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*

COPY dist /usr/share/nginx/html/

RUN touch /var/run/nginx.pid && \
  chown -R nginx:nginx /var/run/nginx.pid && \
  chown -R nginx:nginx /var/cache/nginx && \
  chown -R nginx:nginx /usr/share/nginx/html

USER nginx
正如你所看到的,我已经做了这一行:

运行$(npm-bin)/ng build--prod--build优化器

它应该为我生成
dist/
文件夹


我得到了 这个长日志记录在我的docker云中

我不明白的是,当我在本地使用Dockerfile时,它工作得很好

我应该查看我的网页设置还是Dockerfile语法?

使用
--from
参数将源位置设置为上一个构建阶段

COPY --from=builder /web/dist /usr/share/nginx/html/

对于本地构建,您可能有一个用于本地开发的
dist/
文件夹,该文件夹随后包含在发送给Docker的构建上下文中。本地副本是最终出现在图像中的内容

也许
COPY--from=builder/web/dist/usr/share/nginx/html/
?虽然我不确定它在没有
--from
的情况下如何在本地工作,但您可能在本地为dev创建了一个
dist/
文件夹,然后这就是正在复制的内容。现在将尝试此操作。谢谢你的建议。:)我的构建需要很长时间。99%的延迟导致我的
RUN$(npm-bin)/ng build--prod--build optimizer
你有什么建议吗?有没有其他方法可以实现我想做的事情,而不用在我的容器中构建我的npm构建?不,对不起,我确实看到了你的另一个问题,但我没有尝试在Docker中进行角度构建,所以我没有任何技巧。