【问题标题】:Build Specific Dockerfile from set of dockerfiles in github action从 github 操作中的一组 dockerfile 构建特定的 Dockerfile
【发布时间】:2021-02-24 09:21:54
【问题描述】:

假设我们有 10 个 Docker 文件,但我只在 1 个 Docker 文件中进行了一些更改。所以在 Github 操作中,我们通常构建所有 10 个 docker 文件而不是 1 个 docker 文件。 那么有什么方法可以编写条件,以便 github 操作应该构建我们进行更改的特定 dockerfile。

【问题讨论】:

    标签: docker github dockerfile github-actions building-github-actions


    【解决方案1】:

    您可以尝试使用此 github 操作: https://github.com/trilom/file-changes-action

    查看文档以了解如何使用它。但基本上一个例子会是这样的:

    - name: Get file changes
          id: get_file_changes
          uses: trilom/file-changes-action@v1.2.3
          with:
            githubToken: ${{ secrets.GITHUB_TOKEN }}
            plaintext: true
        - name: Echo file changes
          run: |
            echo Changed files: ${{ steps.get_file_changes.outputs.files }}
        - name: do something on the changed files ussing ${{ steps.get_file_changes.outputs.files }}
          .
          .
          .
          
    

    希望有帮助

    【讨论】:

    • 最好有相关的sn-ps代码的答案,而不仅仅是链接(因为链接可以改变或消失)。
    • 谢谢@J-Mous ...我会尝试使用上述方法来完成它
    • @adityaDamera 让我知道这是否有帮助,请在这种情况下接受我的回答!!
    猜你喜欢
    • 2022-11-03
    • 2021-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2021-01-20
    相关资源
    最近更新 更多