【问题标题】:Docker / docker-compose workflow: angular changes not being reflectedDocker / docker-compose 工作流程:未反映角度变化
【发布时间】:2020-06-12 16:33:06
【问题描述】:

当我更改我的应用程序源代码并重建我的 docker 映像时,这些更改不会反映在更新的容器中。我有:

  • 检查更改是否正确地拉入远程计算机
  • 已清除浏览器缓存并使用不同浏览器仔细检查
  • 检查开发构建文件没有被错误地拉​​到远程机器上
  • 我的头撞在附近的几堵墙上

每次我从 repo 中提取新代码或进行本地更改时,我都会执行以下操作以进行全新的重建:

sudo docker ps -a 
sudo docker rm <container-id>
sudo docker image prune -a
sudo docker-compose build --no-cache
sudo docker-compose up -d

但尽管如此,更改并没有通过 - 我只是不知道它是如何不工作的,因为构建期间的输出似乎正在获取本地文件。它可以从哪里获取旧文件,因为我已经检查并仔细检查了本地源已更改? 码头工人撰写:

version: '3'
services:

  angular:
    build: angular
    depends_on:
      - nodejs
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - certbot-etc:/etc/letsencrypt
      - certbot-var:/var/lib/letsencrypt
      - web-root:/usr/share/nginx/html
      - ./dhparam:/etc/ssl/certs
      - ./nginx-conf/prod:/etc/nginx/conf.d
    networks:
      - app-net

  nodejs:
    build: nodejs
    ports:
      - "8080:8080"

volumes:
  certbot-etc:
  certbot-var:
  web-root:

Angular dockerfile:

FROM node:14.2.0-alpine AS build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

# install and cache app dependencies
COPY package.json /app/
RUN apk update && apk add --no-cache bash git 
RUN npm install
COPY . /app
RUN ng build --outputPath=./dist --configuration=production

### prod ###

FROM nginx:1.17.10-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]

【问题讨论】:

    标签: node.js angular docker nginx docker-compose


    【解决方案1】:

    我找到了。我按照教程让 https 工作,这就是命名卷的来源。这是一个两步过程,第一步需要所有这些命名卷,但是 web-root 卷是搞砸的;删除解决了我的问题。至少我现在更了解 docker 卷了...

    【讨论】:

      猜你喜欢
      • 2019-07-17
      • 2019-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-11
      • 1970-01-01
      • 2020-12-20
      相关资源
      最近更新 更多