angular - 代码更改如何通过 docker-compose 立即生效?
问题描述
我是 MEAN 应用程序的新手,目前正在从事一个项目。我已将前端和后端都包含在 docker 容器中。应用程序在没有问题的 docker 上构建和运行。我的问题是当我想在前后的代码中执行更改时。
执行的任何更改都不会立即发生。我读了几篇关于如何做到这一点的文章,但对我来说不是很清楚,可能是我读过的那些。请在下面找到我当前项目的一些数据。
[后端码头文件]
# Dockerfile
FROM node:10.16.0-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
RUN adduser --disabled-password app
COPY ./* ./
RUN chown -R app:app /opt/app
USER app
RUN npm install
CMD [ "npm","run", "start:dev" ]
[前端 dockerfile ]
# Dockerfile
FROM node:10.20.0-alpine AS builder
RUN apk add --no-cache git=2.24.3-r0 \
--repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community \
--repository https://alpine.global.ssl.fastly.net/alpine/v3.10/main
COPY . ./app
WORKDIR /app
RUN npm i -g @angular/cli
RUN npm install
RUN ng build --prod --aot
# RUN $(npm bin)/ng build --prod --aot
# FROM nginx:1.15.8-alpine
# COPY --from=builder /app/dist/ /usr/share/nginx/html
EXPOSE 4200
#CMD [ "npm", "start" ]
CMD ng serve --host 0.0.0.0 --disable-host-check
# EXPOSE 80 443
# CMD [ "nginx", "-g", "daemon off;" ]
[码头工人-compose.yml ]
version: "3.7"
services:
evillio-backend:
build:
context: evillio-backend/
ports:
- '3000:3000'
evillio-frontend:
build:
context: evillio-frontend/
ports:
- '4200:4200'
[后端包.json ]
"start": "node dist/main.js",
"start-local": "nest start",
"start:dev": "nest start",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
解决方案
推荐阅读
- javascript - 在应用程序脚本中,确认 2 个相邻单元格匹配,然后使用目录选项卡将数据推送到指定的工作表 ID
- python - 如何正确模拟实例化类变量的函数?
- css - Bootstrap 未将 Flask-WTForms QuerySelectField 呈现为 HTML
- javascript - 为什么javascript显示html代码而不是显示内容?
- r - ggplot2中的半圆标记或半圆绘图 - R
- reactjs - REACT 在渲染 UI 之前等待 useEffect 完成
- ios - 如何使用 UIApplication 访问堆叠在另一个视图之上的视图?
- excel - 使用另一个工作表(“摘要”)中的工作表名称对一个工作表(“工作表 A”)中的多个单元格求和
- java - 如何使我的程序能够接收从小到大、大于 21.4 亿的大量数字
- javascript - 尝试使用 Javascript 创建累积分数并显示实验的总分数