在我的配置项中,我希望构建一次docker镜像,然后将同一镜像使用两次(或多次)用于任何后续任务,例如"test“和"lint”。
╭─────────────╮
│ build-image │
╰─────────────╯
⬇
╭──────╮ ╭──────╮
│ test │ │ lint │
╰──────╯ ╰──────╯可以通过container attribute使用自定义容器。但是,我不确定如何使在"build- image“步骤中构建的映像可供该属性访问。
构建镜像并将其用于以下工作的最佳方法是什么?
发布于 2020-11-04 11:14:51
我能够在第一步中构建镜像,并用提交sha标记该镜像。然后,在下一步中,使用sha标记加载容器。
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
with:
registry: registry
repository: user/repo/image-name
tags: ${{ github.sha }}
test:
needs: [build-image]
runs-on: ubuntu-latest
container:
image: registry/user/repo/image-name:${{ github.sha }}https://stackoverflow.com/questions/64582790
复制相似问题