简体   繁体   English

Skaffold 更新文件但应用程序仍然使用启动 Dcoker 图像

[英]Skaffold update files but the app still use the start Dcoker image

I'm having a local cluster using K3d , inside it, there is an API developed in Lumen (Laravel).我有一个使用K3d的本地集群,在它里面,有一个在 Lumen (Laravel) 中开发的 API。

I'm also having Skaffold to work and test my application inside my local cluster.我还让Skaffold在我的本地集群中工作和测试我的应用程序。 I'm running Skaffold in dev mode, that will allow me to hot load my files in case of changes.我在开发模式下运行 Skaffold,这将允许我在发生更改时热加载我的文件。

In my case the files did change inside the container but the app still act as the first pod creation.在我的例子中,容器内的文件确实发生了变化,但应用程序仍然充当第一个 pod 创建。 So I can change file any time the app still have the same state always.所以我可以随时更改文件,应用程序仍然始终具有相同的 state。

Here is my Skaffold deploy config这是我的 Skaffold 部署配置

apiVersion: skaffold/v2beta29
kind: Config
metadata:
  name: api
build:
  tagPolicy:
    sha256: {}
  artifacts:
    - image: api
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '**/*'
            dest: '/var/www/html'
deploy:
  kustomize:
    paths:
      - k8s\dev
profiles:
  - name: base
    deploy:
      kustomize:
        paths:
          - k8s\base

Skaffold's sync only transfers your files: you need to ensure your app or server then uses those changed files. Skaffold 的同步仅传输您的文件:您需要确保您的应用程序或服务器随后使用那些更改的文件。

Some web frameworks are able detect and reload source changes (may require running in a debug mode).一些 web 框架能够检测并重新加载源更改(可能需要在调试模式下运行)。 Other approaches are to use separate tools to monitor for filesystem changes and relaunch the application;其他方法是使用单独的工具来监视文件系统更改并重新启动应用程序; nodemon and watchexec are some typical examples. nodemonwatchexec是一些典型的例子。

If you're syncing data files, you need to ensure that your code reloads file content, and doesn't continue using stale data.如果您正在同步数据文件,则需要确保您的代码重新加载文件内容,并且不会继续使用过时的数据。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 skaffold 为某些文件重建映像,而不会为其他文件重建映像 - skaffold rebuilds image for some files and doesn't for others Kubernetes:如何从持久卷中使用 php (Laravel) 应用程序并在拉取新图像时更新代码更改 - Kubernetes: How to use php (Laravel) app from persist volume and update code changes when pulling new image 有没有一种方法可以使用Ajax监视文件,并且仍然使用Javascript更新文件 - Is there a way to use Ajax to monitor a file, and still update the file using Javascript 使用exif_imagetype验证图像,但仍能够上传非图像文件 - Validate Image with exif_imagetype but still able to upload non image files CI4 您必须使用“设置”方法来更新条目。 已经用set了,还是报错 - CI4 You must use the "set" method to update an entry. Already use set, still error 使用 ob_start 避免创建 zip 文件并获取其内容 - Use ob_start to avoid creating zip files and get their content 防止在图像文件中使用 PHP 包含 - Prevent use of PHP include with image files 更新现在没有错误和“成功”,但数据库中仍然没有图像。 下面更新了代码 - UPDATE now getting no errors and 'success' but still no image in the data base. Updated code below $ _FILES [“文件”] [“名称”]数组在android应用发送文件后为空,但文件仍上传到服务器 - $_FILES[“file”][“name”] array blank after android app send file, but the file is still uploaded to the server 如果上载则更新图像,否则使用以前存储的图像 - update image if uploaded else use previosly stored image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM