forked from NVIDIA/NeMo-Curator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sarah Yurick <[email protected]>
- Loading branch information
1 parent
a0478b7
commit 507db24
Showing
2 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build NeMo Curator container | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: Git ref to checkout | ||
default: ${{ github.sha }} | ||
required: false | ||
type: string | ||
|
||
defaults: | ||
run: | ||
shell: bash -x -e -u -o pipefail {0} | ||
|
||
jobs: | ||
main: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.run_id }} | ||
ref: ${{ inputs.sha }} | ||
|
||
- name: Clean runner cache | ||
run: | | ||
docker system prune --filter "until=24h" --force | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
# We use `docker` driver as this speeds things up for | ||
# trivial (non-multi-stage) builds. | ||
driver: docker | ||
|
||
- name: Pull cache images | ||
run: | | ||
docker pull nemoci.azurecr.io/nemo_curator_container:${{ github.event.pull_request.number || 'buildcache' }} || true | ||
docker pull nemoci.azurecr.io/nemo_curator_container:buildcache || true | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
push: true | ||
build-args: | | ||
MAX_JOBS=32 | ||
ALIGNER_COMMIT=${{ github.event.pull_request.head.sha || github.sha }} | ||
cache-from: | | ||
nemoci.azurecr.io/nemo_curator_container:${{ github.event.pull_request.number || 'buildcache' }} | ||
nemoci.azurecr.io/nemo_curator_container:buildcache | ||
cache-to: type=inline | ||
tags: nemoci.azurecr.io/nemo_curator_container:${{ github.run_id }} | ||
|
||
- name: Update PR image | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
docker tag nemoci.azurecr.io/nemo_curator_container:${{ github.run_id }} nemoci.azurecr.io/nemo_curator_container:${{ github.event.pull_request.number }} | ||
docker push nemoci.azurecr.io/nemo_curator_container:${{ github.event.pull_request.number }} | ||
- name: Update buildcache image | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
docker tag nemoci.azurecr.io/nemo_curator_container:${{ github.run_id }} nemoci.azurecr.io/nemo_curator_container:buildcache | ||
docker push nemoci.azurecr.io/nemo_curator_container:buildcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters