@@ -22,6 +22,10 @@ concurrency:
2222jobs :
2323 changed-files :
2424 runs-on : ubuntu-latest
25+ outputs :
26+ any_changed : ${{ steps.changed-files.outputs.any_changed }}
27+ all_changed_files : ${{ steps.changed-files.outputs.all_changed_files }}
28+
2529 steps :
2630 - uses : actions/checkout@v4
2731 with :
4347 echo '${{ toJSON(steps.changed-files.outputs) }}'
4448 shell :
4549 bash
50+
51+ build-image :
52+ needs :
53+ - changed-files
54+ runs-on : linux-amd64-cpu16
55+ if : needs.changed-files.outputs.any_changed == 'true'
56+ steps :
57+ - name : Login to Docker Hub
58+ uses : docker/login-action@v3
59+ with :
60+ username : ${{ vars.DOCKER_USERNAME }}
61+ password : ${{ secrets.DOCKER_PASSWORD }}
62+
63+ - name : Checkout repository
64+ uses : actions/checkout@v4
65+ with :
66+ submodules : " recursive"
67+
68+ - name : Set up Docker Buildx
69+ uses : docker/setup-buildx-action@v3
70+
71+ - name : Docker Metadata
72+ id : metadata
73+ uses : docker/metadata-action@v5
74+ with :
75+ images : svcbionemo023/bionemo-framework
76+ tags : |
77+ type=schedule
78+ type=ref,event=branch
79+ type=ref,event=tag
80+ type=ref,event=pr
81+ type=raw,value=${{ github.run_id }}
82+
83+ # This action sets up our cache-from and cache-to flags appropriately; see the README of this action for more
84+ # info. It doesn't seem to cache correctly for merge_group events, so we need to add that as an extra argument in
85+ # the step below. There's probably a slight optimization to be had here by caching from the pr- caches for
86+ # merge_group events. See https://github.com/int128/docker-build-cache-config-action/issues/1005 for more info.
87+ - uses : int128/docker-build-cache-config-action@v1
88+ id : cache
89+ with :
90+ image : svcbionemo023/bionemo-build-cache
91+
92+ - name : Build and push
93+ uses : docker/build-push-action@v5
94+ with :
95+ push : true
96+ tags : ${{ steps.metadata.outputs.tags }}
97+ labels : ${{ steps.metadata.outputs.labels }}
98+ cache-from : |
99+ ${{ steps.cache.outputs.cache-from }}
100+ type=registry,ref=svcbionemo023/bionemo-build-cache:main
101+ cache-to : ${{ steps.cache.outputs.cache-to }}
0 commit comments